Posts

Showing posts from January, 2014

java - Why does HALF_UP sometimes round down with double? -

the following code: double doublevalue = 1713.6; float floatvalue = 1713.6f; string fs = "%-9s : %-7s %-7s\n"; system.out.printf( fs, "", "double", "float" ); decimalformat format = new decimalformat("#0"); system.out.printf( fs, "tostring", string.valueof( doublevalue ), string.valueof( floatvalue ) ); format.setroundingmode( roundingmode.down ); system.out.printf( fs, "down", format.format( doublevalue ), format.format( floatvalue ) ); format.setroundingmode( roundingmode.half_down ); system.out.printf( fs, "half_down", format.format( doublevalue ), format.format( floatvalue ) ); format.setroundingmode( roundingmode.half_up ); system.out.printf( fs, "half_up", format.format( doublevalue ), format.format( floatvalue ) ); format.setroundingmode( roundingmode.up ); system.out.printf( fs, "up", format.format( doublevalue ), format.format( floatvalue ) ); produces result ( live

How to fix error "Unfortunately, the process com.android.systemui has stopped" -

i'm working on streaming app streams internet feed of fm radio station. when app loads, , hit play button, emulator crashes, , following error: "unfortunately, process com.android.systemui has stopped" emulator returns lock screen, stream begins play regardless, , when unlock phone screen app returns normal. i think may problem emulator, not sure. i'm using genymotion android emulator. code follows: public class mainactivity extends activity { private boolean initialstate = true; private imagebutton button; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); button = (imagebutton)findviewbyid(r.id.btnplay); button.setbackgroundcolor(color.black); button.setimagedrawable(scaleimage(contextcompat.getdrawable(this, r.drawable.playwhite),0.2f)); } public void playpause(view arg0) { // intent startintent = new intent(mainactivity.this,foregroundser

model view controller - Is it recommended to use Node.js for an online room booking web application? -

i have build web application booking hostel rooms online. hostel has 78 independent clusters consisting of 11 rooms. has total 858 rooms. a user can take room individual or in group of 2-11 persons. there 3 entities in system: user, room , group. have sign-up on system , can join group or can take room. registrations starts week prior actual allotment day i.e. user can register can't book room. on actual allotment day, admin of group book rooms group members on first come first serve basis. allotment process hardly takes 30 mins. there 80-90 users simultaneously online on website book rooms. last year hosted app on shared web hosting on start of allotment process, site down. nobody able log-in , book rooms. existing app developed in php. so whole story. want re-write whole app using mvc architecture. thinking use node.js. technology stack best suitable application? can point me in right direction choosing architecture app? if want use mvc nodejs, give sails.js t

java - String with up to 2 decimal places Android -

this question has answer here: double parameter 2 digits after dot in strings.xml? 3 answers currently in strings.xml have `<string name="price_string">my string price: %1$s</string>` the problem outputs 5, instead of 5.5. how format include 2 decimals? <string name="price_string">my string price: %0.2f$s</string>`

c# - Get all containing flags -

i have variable containing flags , wounder how i'm able check flags set. my flags. [flags] public enum button{ //can't have more 30 flags //if enum added or deleted need change loop in method addbutton // exit flags exit = 1 << 0, cancel = 1 << 1, abort = 1 << 2, close = 1 << 3, //proced flags accept = 1 << 4, ok = 1 << 5, submit = 1 << 6, //question flags no = 1 << 7, yes = 1 << 8, //save , load save = 1 << 9, saveall = 1 << 10, savenew = 1 << 11, open = 1 << 12, load = 1 << 12 } and here check flags (int = 1; <= 12; ++i) { if((buttons & 1 << i) == 1 << i){ } } apparently can't use way check flags. to clear want know flags set in buttons. update: can't

python - How to create DNS TXT record? -

i want create dns txt record type programmatically python code. did not find data of how doing or specific format of txt record. here how tried create txt record python: # copy id of request packet+=self.data[:2] # add flags of response packet+= "\x81\x80" # questions , answers counts packet+='\x00\x01' packet+='\x00\x01' #no records follow packet+='\x00\x00' # additional records follow packet+='\x00\x00' #packet+='\x00\x01' (urllist,urldatalength) = decodequery(self.data) urlposition = urldatalength # original domain name question packet+=self.data[12:12+urldatalength+4] # pointer domain name packet+='\xc0\x0c' #response type ~~~~~~~~~~~~~~~~ # response type (txt) packet+='\x00\x10' #class packet+='\x00\x01' #ttl packet+='\x00\x00\x02\x58' #d

C float in NASM x86 assembly -

in university project have use binary representation of float number in x86 assembly arithmetic operations. using fpu forbidden try read float number , return dword whatever try "-nan". advices? edit: use gcc , it's 32 bit code declaration in c (i can't change that) extern "c" float func(float num); *.asm file section .text global func func: ;prolog push ebp mov ebp, esp ; zapamiętanie rejestrów zachowywanych push ebx push esi push edi mov eax, dword [ebp+8] ;mov eax, 0xffffffff checked still same result ; odtworzenie rejestrów, które były zapamiętane pop edi pop esi pop ebx ;epilog pop ebp ret example result (for 256) 01000011100000000000000000000000 11111111110000000000000000000000 num1: 256.000000 num2: -nan edit: c code without checking bits part #include <stdio.h> extern "c" float func(float num); int main() { float num1; float num2; scanf(&q

xcode - Invoking a custom Timer Class -

i've cobbled timer class use nstimer viewcontrollers, code below import foundation class timer { var timer = nstimer() var handler: (int) -> () let duration: int var elapsedtime: int = 0 init(duration: int, handler: (int) -> ()) { self.duration = duration self.handler = handler } func start() { self.timer = nstimer.scheduledtimerwithtimeinterval(30, target: self, selector: selector("chkprogress"), userinfo: nil, repeats: true) } func stop() { timer.invalidate() } @objc func chkprogress() { self.elapsedtime++ self.handler(elapsedtime) if self.elapsedtime == self.duration { self.stop() } } deinit { self.timer.invalidate() } } then in each viewcontroller can check time progress , display message accordingly. problem when try invoke it i've tried var timer = timer() var timer = timer(30) var timer = ti

php - how to extract specific span content from webpage -

i looking scrape content of webpages. i have following code not work on every page. $url1 = 'http://www.just-eat.co.uk/restaurants-tomyumgoong/menu'; $url2 = 'http://www.just-eat.co.uk/'; $curl = curl_init($url1); curl_setopt($curl, curlopt_returntransfer, true); $page = curl_exec($curl); if (curl_errno($curl)) // check execution errors { echo 'scraper error: ' . curl_error($curl); exit; } echo $page; curl_close($curl); $regex = '/<div class="responsive-header-logo">(.*?)<\/div>/s'; if (preg_match($regex, $page, $list)) echo $list[0]; else print "not found"; $url1 not working, when use $url2 works charm. what can fix this? try simplifying regex just: $regex = '/responsive-header-logo/';

javascript - Avoid onRowClick event when outputLink is clicked inside of RichFaces datatable -

how avoid call onrowclick on datatable on column has outputlink (target new window)? <rich:datatable id="dt" value="#{bean.cars} var="_car"> <a:support event="onrowclick" action="#{action.navigatetocardetails(_car.id)}"/> <rich:column> <f:facet name="header">select</f:facet> <a:commandlink onclick="event.stop(event)" action="#{bean.toggleselectedcar(_car.id)}" rerender="dt" ajaxsingle="true" limittolist="true"> <h:graphicimage value="/img/icon_checkbox_#{bean.iscarselected(_car.id) ? 'active' : 'inactive'}.gif"/> </a:commandlink> </rich:column> <rich:column> <f:facet name="header">brand</f:facet> <h:outputlink value="#{_car.link}" target="_blank"> &

purescript - Monad Transformer for Halogen Components -

i'm trying figure out in way can use transformer on monad halogen component contains. i'd extend intro example readert carries config record in case used make strings configurable, i'm lost when comes putting together. let's define our config this: -- | global configuration newtype config = config { toggletext :: string , ontext :: string , offtext :: string } our ui function turn from forall m eff. (monad m) => component m input input to forall m (monad m) => component (readert config m) input input . to evaluate our main function, we'd use hoistcomponent turn previous form: main = let config = config { toggletext: "toggle button" , ontext: "on" , offtext: "off" } tuple node _ <- runui $ hoistcomponent (runreadert config) ui appendtobody node i'm not sur

javascript - Return results in a list by a search input -

friends, trying learn how can make 'trivial' search input.. html without consulting database. i have list of 8 options, , make js function me hide options don't match search. http://codepen.io/pen/ <div class="search__dropdown"> <div class="search__dropdown-header"> <h3 class="search__dropdown-title">hostel</h3> </div> <div class="search__dropdown-body"> <input class="search__dropdown-input search__dropdown-input--search" type="text" placeholder="procure" /> <ul class="search__dropdown-list search__dropdown-list--hostel"> <li class="search__dropdown-item"> <input class="search__dropdown-checkbox" name="hostel1" type="checkbox" id="hostel1" /> <label class="search__dropdown-label" for=&q

javascript - Can't render store into the grid (Ext.js) -

https://github.com/hil400k/first-ext here project, can't understand wrong i app/view/todogrid.js , app/store/todos.js try setting store in app/view/todogrid.js store: ext.create('se.store.todos') . lookup() finding store has been created. also, might need include ext.require(['se.store.todos', 'se.view.todogrid']); @ top of mainview.js. little fuzzy on when required , when can figure out include itself.

python - Cythonizing string array comparison function to be applied to pandas DataFrame -

i getting started cython , appreciate pointers how approach process. have identified speed bottleneck in code , optimize performance of specific operation. i have pandas dataframe trades looks this: codes price size time 2015-02-24 15:30:01-05:00 r6,is 11.6100 100 2015-02-24 15:30:01-05:00 r6,is 11.6100 100 2015-02-24 15:30:01-05:00 r6,is 11.6100 100 2015-02-24 15:30:01-05:00 11.6100 375 2015-02-24 15:30:01-05:00 r6,is 11.6100 100 ... ... ... ... 2015-02-24 15:59:55-05:00 r6,is 11.5850 100 2015-02-24 15:59:55-05:00 r6,is 11.5800 200 2015-02-24 15:59:55-05:00 t 11.5850 100 2015-02-24 15:59:56-05:00 r6,is 11.5800 175 2015-02-24 15:59:56-05:00 r6,is 11.5800 225 [5187 rows x 3 columns] i have numpy array called codes : array(['4', 'ap', 'cm', 'bp', 'fa', 'fi', 'nc', 'nd

sql - SSMS Temp Table / Parameter Issue -

i have temp table 2 columns, each column parameter i've declared. i've done using sql. declare @sourcekey varchar(40) = '1109' ,@department key varchar(1500) = '14,55 the table populated using following sql: if object_id('tempdb..#department','u') not null drop table #department create table #department (departmentkey int ,baseterm varchar(5)) insert #department select value ,skt.key yyy.parselist(@department,',') join #sourcekeytable skt on skt.key = skt.key if select * #department these results: department key | sourcekey 14 | 1109 55 | 1109 thats expect. join temp table main query so join #department d on table.rkey = d.departmentkey i need have temp table allow multi-select in visual studio report. however, department key equal 14 and 55 skewing results. need 1 value passed 14 or 55 not both. temp table neccessary multi-select. any suggestions on how pas

java - Can't add JSONObjects into an array -

i using json simple parse json file. when jsonarray . when try iterate through , jsonobject elements error. this code: jsonarray jsondata = (jsonarray) jsonparser.parse(reader); list<jsonobject> elementslist = new arraylist<jsonobject>(); (int = 1; < jsondata.size(); i++) { elementslist.addall(jsondata.get(i)); // here jsondata.get(i) jsonobject } i following errors in eclipse: the method addall(collection) in type list not applicable arguments (object) type safety: unchecked cast object collection not sure these mean , how fix that. jsonarray#get(int) has return type of object (because inherited raw type arraylist ). list#addall(collection) expects argument of type collection . type object not convertible collection without type cast. however, if cast value returned get , underlying value jsonobject , you'd classcastexception @ runtime. what want elementslist.addall(jsondata); // outside loop since jsonarray subt

html - jquery to remove text in a page -

i wish remove text "documenttype :" following html (i not concerned title or alt): <tr class="ms-gb" ishdr="true" isexp="true"> <td colspan="100" nowrap="nowrap"> <a href="javascript:" onclick="togglespgridviewgroup(this, false)" title="expand/collapse documenttype : agreement - contract"> <img src="/_layouts/images/minus.gif" border="0" alt="expand/collapse documenttype : agreement - contract"/> </a> &#160;documenttype : agreement - contract </td> </tr> in page, have jquery loops through "ms-gb" classed element, cannot seem dive appropriate elements find "documenttype : " in order perform .replace() empty text: <script type="text/javascript"> $(document).ready(function () { $(".ms-gb").each(function () { var rownums = $(

android - Unbinding a service from an activity other its originator -

how can go unbinding service after i've moved different activity? main problem no longer have reference original serviceconnection in new activity, can't call unbindservice . there way pass serviceconnection new activity, or can grab reference service other way? i think better if this: 1- start service calling startservice() . 2- bind() activity service in oncreate() or onresume() 3- interact it 4- unbind() activity service in onpause() or ondestroy() repeat #2 #3 #4 other activities 5- once done service, stop calling stopservice()

c# - Monitor Application logs as part of Jenkins -

i have ci server using jenkins builds code, starts server, , runs application tests. monitor logs during process check errors (e.g., "error"). see log parser plugin jenkins seems monitor console logs. i goes against application log. in particular case i'm using .net server (iis/c#/asp). maybe need utility specific architecture , run command line interface in jenkins. or should using cloud service monitor application logs? the text-finder plugin can parse files , change build status if search matches. i'm not sure solve issue if want live monitoring on running applications. but if launch job every minutes, job :)

c# - Issue with maxStringContentLength on WCF -

i have inherited wcf web service running asp.net 2 on iis 7. however, have problem when posting large amounts of data, produces error 400 bad request. i've added element, trace producing following error "there error deserializing object of type cix.api.contracts.postmessage. maximum string content length quota (8192) has been exceeded while reading xml data. quota may increased changing maxstringcontentlength property on xmldictionaryreaderquotas object used when creating xml reader. line 51, position 322." i've included whole system.servicemodel below - can spot that's amiss? i've been trying fix time, i've been unable , appreciated. <diagnostics> <messagelogging logmessagesattransportlevel="true" logmessagesatservicelevel="false" logmalformedmessages="true" logentiremessage="true" maxsizeofmessagetolog="65535000" maxmessagestolog="500" /> </diagnostics> <e

Python OpenCV error: (-215) size.width>0 && size.height>0 in function imshow -

i run program , returns me error message: error: (-215) size.width>0 && size.height>0 in function imshow how can solve? source code: import numpy np import cv2 cap = cv2.videocapture(0) ret,frame = cap.read() r,h,c,w = 250,90,400,125 track_window = (c,r,w,h) roi = frame[r:r+h, c:c+w] hsv_roi = cv2.cvtcolor(frame, cv2.color_bgr2hsv) mask = cv2.inrange(hsv_roi, np.array((0., 60.,32.)), np.array((180.,255.,255.))) roi_hist = cv2.calchist([hsv_roi],[0],mask,[180],[0,180]) cv2.normalize(roi_hist,roi_hist,0,255,cv2.norm_minmax) term_crit = ( cv2.term_criteria_eps | cv2.term_criteria_count, 10, 1 ) while(1): ret ,frame = cap.read() if ret == true: hsv = cv2.cvtcolor(frame, cv2.color_bgr2hsv) dst = cv2.calcbackproject([hsv],[0],roi_hist,[0,180],1) ret, track_window = cv2.meanshift(dst, track_window, term_crit) x,y,w,h = track_window img2 = cv2.rectangle(frame, (x,y), (x+w,y+h), 255,2) cv2.imshow(

c# - Combining several fields using Linq -

i'd combine several table fields in order produce combined value. here's code: from _showtime in db.tbl_concert_showtime join _concerthall in db.tbl_concert_concerthall on _showtime.concerthallid equals _concerthall.concerthallid join _hall in db.tbl_concert_hall on _concerthall.hallid equals _hall.hallid join _hallfloor in db.tbl_concert_hall_floor on _hall.hallid equals _hallfloor.hallid join _place in db.tbl_concert_hall_floor_place on _hallfloor.floorid equals _place.floorid _place.placeid == id select _showtime the showtime table includes showid , startdate , starttime , endtime fields. how can select startdate , starttime in field? something this: 2015/12/12 12:25 -> 12:58 from _showtime in db.tbl_blablabla select _showtime.startdate + " " + _showtime.starttime + " -> " + _showtime.enddate if wanna keep original showtime object a

c# - How can i tell my Program to "re-do" diffrent Actions (chosen by User-Input) after it is done, till the do-while Requirement is set? -

im beginner in c# , im working on console application, want program able read input of user , execute orders until has 0 hp. basicly gonna "fighting-game". my problem now, can ask user input once(and execute input program once got). want add additional fighting options aswell, im stuck here. static void main(string[] args) { int playerhealth = 100; int playerdamagesword = 10; int playerdamagefire = 10; int playerheal = 20; int enemyhealth = 100; console.writeline("hey! enter character name!"); string name = console.readline(); console.clear(); console.writeline("okay! " + name + " have encountered enemy! action choose?\n1.sword-attack\n2.fire-attack\n3.heal\n8.flee\n9.quit\n" ); string input = console.readline(); { if (input == "1") { console.writeline("you hit opponment 10 damage!

angularjs - Error: Argument 'Ctrl' is not a function, got undefined -

var myapp = angular.module('myapp', []); myapp .config(['$routeprovider',function($routeprovider) { $routeprovider. when('/login', { templateurl: 'static/lib/templates/login.html', controller: 'ctrl' }). otherwise({ redirectto: '/addorder' }); }]); my html: <body ng-controller="ctrl" > ..... </body> i getting error saying controller not defined. is ctr defined in js file? typically like... var app = angular.module('myapp', ['ngresource', 'ngroute']); app.controller('ctrl', function ($scope, $http) { console.log("a login ctrl...."); }); make sure including ctrl script in html: <script src="login.controler.js"></script>

javascript - jquery cookie issue: $.cookie is not a function -

i know question has been asked multiple times. looked @ many answers couldn't find solution. i trying load jquery.cookie.js script. here how: <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js"></script> <script type="text/javascript" src="scripts/jquery.cookie.js"></script> <script type="text/javascript" src="scripts/javascript.js"></script> this javascript: $(document).ready(function () { var jobstats_class = $.cookie('jobstats'); // add toggle feature $('.jobstats caption').click(function () { $('.jobstats th,.jobstats td').slidetoggle('1000'); }); $('.ricsubscriptions caption').click(function () { $('.ricsubscriptions th,.ricsubscriptions td').slidetoggle(

jquery - Parse JSON File in Javascript -

i have json file stored in same folder html file webpage i'm working on. html file has script function takes data in variable in json form. i'm having trouble getting contents of json file variable in html file used function. running html file locally. i've tried following: $(function(){ $.getjson("./data.json", function(jsdata) { json = jsdata; console.log(json); }); }); however, results in: xmlhttprequest cannot load file . there way parse local json file in javascript? the json validated using http://jsonlint.com/ using "data.json" gives same error before. do not use . . if json file in same folder location js running (i.e. html file), should this: $(function(){ $.getjson("data.json", function(jsdata) { json = jsdata; console.log(json); }); });

c# - Big collections in DDD using Entity Framework -

i try use ddd describe domain model , code first approach on mapping database tables entity framework (using fluent api). example have 2 entities: clubs , users. club has many users. , need add new user club. class user { public string name { get; set; } public club club { get; set; } } class club { public string clubname { get; set; } public icollection<user> members { get; set; } public void addnewmember(user user) { //..some logic , checks members.add(user); } } so, should load users collection in club add new , save? or it's excessively? what best way modeling entities big collections? should load them? or move separate object? should load users collection in club add new , save? no, can add new user club.members , ef save new user. it's not necessary load users first. what best way modeling entities big collections that doesn't depend on potential size of collections on how plan ac

search - Selenium IDE: VerifyTextPresent alway returns true -

i want search several hyperlinks in page (dynamically generated in table) whether contain value "hello". i use: <td>verifytextpresent</td> <td>hello</td> <td></td> and returns false i use: <td>verifytextpresent</td> <td></td> <td>hello</td> and returns true what correct way search string anywhere in page? verifytextpresent(pattern) command deprecated. use verifytext command element locator instead. you should consider using verifytext locator, can body: <tr> <td>verifytext</td> <td>//body</td> <td>search term</td> </tr> but since want limited links suggest using this: <tr> <td>verifyelementpresent</td> <td>//a[text()=&quot;search term&quot;]</td> <td></td> </tr> which links contain search text (exactly, can use contains() function parti

javascript - How to round smoothly percentage in JS -

i have object containing decimals values : evo , meteo , usage try display values 3 conditions : values can positive , negative values must displayed percentage without decimals (a) must true (a): math.round(meteo*100)+math.round(usage*100) = math.round(evo*100) for example, if apply these values {evo: 0.1466, meteo: 0.1231, usage: 0.0235} we unvalid percentages : evo: 15% meteo: 12% usage: 2% because values rounded, (a) isn't verified. working on getsmooth function adjust rounded values equation (a) verified. var smooth = getsmooth(math.round(evo*100), math.round(meteo*100), math.round(usage*100); function getsmooth(evo, meteo, usage){ // case need incremente if( math.abs(evo) > math.abs(meteo) + math.abs(usage) ){ // case need incremente usage if( math.abs(meteo) > math.abs(usage) ){ (usage > 0) ? usage++ : usage--; } // case need incremente meteo else{ (meteo > 0) ?

How to make an Auto Clicker with Java? -

so wanted make program holds down mouse button me. so far i've got this: http://pastebin.com/utjwdhy7 what i'm wondering how can stop it. also, realise stopping button makes no sense wouldn't able click anyway. tips on how i've done far nice. edit (adding code): package main; import javax.swing.*; import javax.swing.border.lineborder; import java.awt.*; import java.awt.event.actionevent; import java.awt.event.actionlistener; import java.awt.event.inputevent; import java.beans.propertychangelistener; public class clickforever extends jframe implements actionlistener { public static boolean isclicking = false; public void actionperformed(actionevent e) {} public void createframe() { initcomponents(); } public void initcomponents() { jframe frame = new jframe("autoclicker"); jpanel panel = new jpanel(true); jbutton button = new jbutton("okay"); jlabel label = new jlabel(); frame.setvisible(true); frame.setsize

Expected timestamp in the Flume event headers, but it was null -

i using below configuration details push twitter feeds hdfs using flume, getting expected timestamp in flume event headers, null twitter.conf twitteragent.sources = twitter twitteragent.channels = memchannel twitteragent.sinks = hdfs twitteragent.sources.twitter.type = org.apache.flume.source.twitter.twittersource twitteragent.sources.twitter.channels = memchannel twitteragent.sources.twitter.consumerkey = xxxxxxxxxxxxxxxxxxxxx twitteragent.sources.twitter.consumersecret = xxxxxxxxxxxxxxxxxxxxxxxx twitteragent.sources.twitter.accesstoken = xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx twitteragent.sources.twitter.accesstokensecret = xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx twitteragent.sources.twitter.keywords = bigdata, hadoop, hive, hbase twitteragent.sinks.hdfs.channel = memchannel twitteragent.sinks.hdfs.type = hdfs twitteragent.sinks.hdfs.hdfs.path = /user/farooque/bigdata/tweets/%y/%m/%d/%h/ twitteragent.sinks.hdfs.hdfs.filetype = datastream twitteragent.sinks.hdfs.hdfs.writeformat = text

c# - Extension methods with base and sub-classes -

update requesting re-open because other answers don't have solution, 1 of comments question has solution want accept works scenario. original question i having trouble writing extension methods non-abstract base classes , sub-classes select appropriate extension method. example code i have simple example below (abstracted bigger project) uses extension method "run". expected output listed in comment next each class. public class parent { }; // should output "parent" public class childa : parent { }; // should output "child a" public class childb : parent { }; // should output "parent" // expected output: childa, parent, parent public class program { public static void main() { var commands = new list<parent>() { new childa(), new childb(), new parent() }; console.writeline(string.join(", ", commands.select(c => c.run()))); } } here attempts far, there has cleaner way this: n

c# - SoapHttpClientProtocol throws ConnectFailure despite having successfully sent message on WM 6.5 with .NET CF 3.5 -

here's knotty one. this windows mobile 6.5 device running .net compact framework 3.5.9085.00 simple auto-generated web service call via automatically generated soap proxy, subclass of system.net.soaphttpclientprotocol (c#) the call doinvoke() throws system.net.webexception not connecting network. indicate kind of web-proxy or connection error, when stick simple logging server @ web service address can see post being received loud , clear, can connect network. the same code works absolutely fine on device of same model. when use simple logging server can see identical post other device, 1 throws system.net.webexception: operation has timed-out instead (which would, isn't going response). i'm baffled. there's doubtless configuration difference between 2 that's causing problem i've no idea what. it's though first device has set write-only connection server , falls on when tries read response, i've never heard of such situation before. anybo

android - Admob Mediation with Adcolony and others -

i have been working on android , ios applications cocos2dx 2.2.6 , have added admob integration. understand general question wondering if had tips how make money admob. have been having trouble setting admob mediation. have tried add adcolony ads in addition regular admob ads game life of me can't figure out how out of "pending" phase. if did out of phase have special codewise make work? or fill container wtih adcolony ads sometimes. if has knowledge of how process works or how optimally set admob mediation of great me. thanks. i adcolony out of pending state integrating standalone sdk. once see test ad ad colony, use admob mediation , add ad colony details it. documentation provided via admob mediation simple , straightforward , requires no additional coding work.

shortcut for Django Get data and mark_safe a specific column -

i'm wondering if there shortcut code? code get's video data , mark_safe embed code. videos = video.objects.all() mark_safe_videos = [] video in videos: video.embed_code = mark_safe(video.embed_code) mark_safe_videos.append(video) i'm using django 1.8 you can add property model , avoid additional code in view: from django.template.defaultfilters import mark_safe class video(models.model): . . . @property def safe_embed(self): return mark_safe(self.embed_code) i tend favor "fat model, skinny controller (view in django)" methodology.

r - How can I force a line break in rmarkdown's title for ioslides presentation? -

this question has answer here: split title onto multiple lines? 3 answers the solution html_document output not work ioslides_presentation output. how can force title change @ specific location? the solution html_document output produces strange results. --- title: | | extremely long title | desired line break @ | specific location output: ioslides_presentation --- well, figured out myself. can add html tags title, e.g. <br> . works: --- title: extremely long <br> title <br> desired line break <br> @ specific <br> location output: ioslides_presentation ---

python - Attempting to Base64 encode this variable -

i'm trying encode 'username' variable base64, write text file, , decode base64, , read/print it. while true: username = input("what username?: ") file = open("newfile.txt", "w") file.write(base64.b64encode(username)) file.close file = open("newfile.txt", "r") file.read(base64.b64decode(username)) break -typeerror- 'str' not support buffer interface what did here seemed logical out of i've seen. i new python, , have tried method's i've seen online base64 encode variable, , none have worked. base64 expects , returns bytes (in python3); strings must written files. here example explicit writing , more compact reading: import base64 while true: username_str = input("what username?: ") open("newfile.txt", "w") file_handler: username_bytes = bytes(username_str, 'utf-8') b64_bytes = base64.b64encode(username_bytes)

r - Function flow: why does this function return 20 -

suppose have function called l : l <- function(x) x + 1 then define function, m , within m , redefine l : m <- function() { l <- function(x) x*2 l(10) } m() why m return x*2 , , not x+1 ? if you're not sure what's going on, can helpful add print statements. let's add few print statements code -- 1 before m called, 2 inside m function, , 1 after m called: l <- function(x) x + 1 m <- function() { print(l) l <- function(x) x * 2 print(l) l(10) } print(l) # function(x) x + 1 m() # function(x) x + 1 # function(x) x * 2 # <environment: 0x7f8da5ac3b58> # [1] 20 print(l) # function(x) x + 1 before m called , @ top of m , l defined function returns x+1 . however, within m change l new function, 1 returns x*2 , indicated second print statement in function. result, calling l(10) returns 20. once leave function original l definition ( x+1 ) because x*2 version defined function. concept of function being d

java - jsch channel gets disconnected when called for the second time -

my requirement connect remote machine via ssh using java . using jsch same. have sequence of commands executed , each command execution depends on output of previous command. fox example, if executing: ls -l after login remote machine calling: runcommand(“ls -l\n”); based on output above step need create directory: runcommand(“mkdir test\n”); on executing getting: com.jcraft.jsch.jschexception: failed send channel request @ com.jcraft.jsch.request.write(request.java:65) @ com.jcraft.jsch.requestptyreq.request(requestptyreq.java:76) @ com.jcraft.jsch.channelsession.sendrequests(channelsession.java:212) @ com.jcraft.jsch.channelshell.start(channelshell.java:44) @ com.jcraft.jsch.channel.connect(channel.java:152) @ com.apple.mailmove.ssh.executesecureshellcommand.runcommand(executesecureshellcommand.java:90) @ com.apple.mailmove.ssh.executesecureshellcommand.main(executesecureshellcommand.java:160) and here runcommad code: //find below method public void runco

logging - What's the proper way to log big data to organize and store it with Hadoop, and query it using Hive? -

so have apps on different platforms sending logging data server. it's node server accepts payload of log entries , saves them respective log files (as write stream buffers, fast), , creates new log file whenever 1 fills up. the way i'm storing logs 1 file per "endpoint", , each log file consists of space separated values correspond metrics. example, player event log structure might this: timestamp user mediatype event and log entry 1433421453 bob iphone play based off of reading documentation, think format hadoop. way think works, store these logs on server, run cron job periodically moves these files s3. s3, use logs source hadoop cluster using amazon's emr. there, query hive. does approach make sense? there flaws in logic? how should saving/moving these files around amazon's emr? need concatenate log files 1 giant one? also, if add metric log in future? mess previous data? i realize have lot of questions, that's becau

github - Per File Permisions With Git -

i starting new project shortly , trying figure out best way setup git repo. have 2 teams. non-restricted , restricted, issue trying solve want set file permissions restricted team limit them being able commit files inside repo. when restriced team memeber pulls repo down want replace files auto generated dll's. restricted team outsource labour dont trust , dont want them being able commit files within repo, , dont want them being able see "secret sauce". non-restriced team should have read/write access files.any ideas how accomplish this? it looks google's repo trick? i guess possible forbid access files or folders setting git hooks, doesn't seem solution imho case. if in start of project consider splitting project modules keep them in different repositories if it's possible. let's 1 repository local developers core of system contains "secret sauce" , second modules dependent on core libraries , can outsourced. can build core libra

asp.net - using VB.NET Shared Property in inline-code: `<% =<property> %>` -

i'm using shared property add text div . step of procedure is: define shared property submitted= "not submitted" in myclass.vb . create mymasterpage.master div: <div><%=submited%></div> create page1.aspx code-behind: protected sub page_load (...) if action="submitted" submitted="submitted" end if end sub so far, fine, problem when master loads again , submited keeps value , show: <div>submitted</div> i need 1 time specified submitted "submitted" ,next time submited called, returns "not submited" (i.e. it's orginal value) <div>not submitted</div> don't use shared variable or property this. a shared ( static in c#) variable shared across users of web application. imagine 2 users , b accessing web site @ same moment. doing cause user see supposed user b, , vice versa. wouldn't want that, you? the solution simple: don't make proper

Is it possible to output a variable as a cmd command from a c++ program -

im making simple command line program c++ knowledge basic level, send command c++ program cmd made of part of command , rest variable here code far: #include <iostream> #include <stdlib.h> using namespace std; int main() { string directory; cout<<"input directory make folder in: "; cin>> directory; system("mkdir" directory); } i error: error: expected ')' before 'directory'| does know way of doing this? in end cmd execute command "mkdir c:*inputted directory* i have hacked around trying work out, no success, have had on internet no avail, in advance. rather call out shell use _mkdir (for windows ) or mkdir (for linux ) function instead: _mkdir(directory.c_str()); for windows you'll need #include <direct.h> , linux you'll need #include <sys/stat.h> , #include <sys/types.h>

iOS storyboard weird error - 'NSInternalInconsistencyException' (Main.storyboardc) -

Image
i working on xcode project. have clean project , try build project. dont know happen got weird error. *** terminating app due uncaught exception 'nsinternalinconsistencyexception', reason: 'could not load nib in bundle: 'nsbundle (loaded)' name 'uiviewcontroller-bsa-xt-tpg' , directory 'main.storyboardc' don't know code have check!! refereed question related can't solve problem. edit:- when tried search storyboardc in find navigator. gives result this. edit: i not able see storyboard in build phases. have tried add manually still appears in red symbol this. my problem solved. don't know correct method or not. have move main.storyboard from base.lproj other folder. delete main.storyboard folder , again drag , drop in mainbundle means project window , tick mark in localization setting. clean , build , run project successfully.

php - Cakephp 2 : Have two different authentication functions -

i using custom authentification object in cake php. have created file in component/auth/ldapauthenticate.php . in file have function made authentification ldap. looks this: app::uses('baseauthenticate', 'controller/component/auth'); class ldapauthenticate extends baseauthenticate { public function authenticate(cakerequest $request, cakeresponse $response) { $username=$request->data["users"]["username"]; $pwd=$request->data["users"]["password"]; $ldap = ldap_connect("ldap:........"); ldap_set_option ($ldap, ldap_opt_referrals, 0); ldap_set_option($ldap, ldap_opt_protocol_version, 3); $bind = @ldap_bind($ldap, "test\\".$username, $pwd); if ($bind && $pwd!="") { //cakelog::write('debug', "loggé"); $ldap_dn ="dc=world,dc=pcm,dc=local"; $filter = "(&(objectc

vbscript - VBS FileSystemObject.DeleteFolder Path does not exists, yet FileSystemObject.FolderExists is true -

i'm close going insane. have configuration of code in vbs , throws error should logically impossible. check code: (you need @ least 10 reputation post images. sure helpful.) http://i.stack.imgur.com/jjndm.png if folder revfolder exists, (force) delete it. means if folder not exist, no deletefolder executed. literally have folder in front of me, it's there, can see it. created same code few lines up. folderexists returns true folder exists. yet throws error "path not found". what going on? must bug in vbs, right? .folderexists tolerates spurious "\", .deletefolder doesn't: >> wscript.echo gofs.folderexists("c:\documents , settings\eh\30643986\") >> gofs.deletefolder "c:\documents , settings\eh\30643986\" >> -1 error number: 76 error description: path not found >> gofs.deletefolder "c:\documents , settings\eh\30643986" >> wscript.echo gofs.folderexists("c:\docume

hadoop - Create external table but warehose empty? -

i using hive v0.13 my data stored in hdfs, use create "create external table" create table data. works fine, can issue "select" statements. question under warehouse directory (hive.metastore.warehouse.dir) , don't see files/data added, normal? know "external" table data not copy warehouse directory shouldn't there table meta data stored under there? when create internal table hive creates directory table name under directory have specified in hive.metastore.warehouse.dir . me /apps/hive/warehouse. suppose have created table name test_tbl there directory /apps/hive/warehouse/test_tbl and hive store metadata mysql or configured rdbms store metadata.and when load data using load data inpath command directory. but in external table specify location in create statement hence hive doesn't create directory in default warehouse directory because have provided location. store metadata information in rdbms you can directly

sprite kit - SWIFT - Can I have a SKView as a subview of a UIView? -

in storyboard, have base uiview, uiview containing square board drawing in cgrect , buttons , status fields above , below. tried drawing playing pieces animating them became nightmare have rendered them sprite nodes in array , animate themselves. far good. layer on top of skview view , want present spritekit scene in there skview.allowstransparency = true have sprites on transparent background (revealing board below) , using tapgesturerecognizers effect sprite animation event handling. so in ib hierarchy is: vc / uiview / boardview: uiview / skview problem is, spritekit scene targets top level uiview not skview game pieces behind board. missing simple here? i'm gonna try placing child vc skview assist, if i've missed trick, appreciated. i wish see code, create iboutlet skview, have outlet present scene, doing in app working on, know doable