Posts

Showing posts from February, 2013

entity framework - Loading related objects without Include() -

entity framework - Loading related objects without Include() - briefly, i'm loading objects descend base of operations class using repository defined against base of operations class. although objects created right descendant classes, descendant classes add together navigation properties not nowadays in base of operations class not have related objects loaded, , have no way explicitly request them. here simple method in repository class loads given calendar event assuming know id value: public calendarevent getevent(int eventid) { using (var context = new calendareventdbcontext(connectionstring)) { var result = (from evt in context.calendarevents eventid.equals((int)evt.eventid) select evt).tolist(); homecoming result.tolist()[0]; } } calendarevent base of operations class big number of more specific classes descend. entity framework correctly d

Does grails command requires internet connectivity -

Does grails command requires internet connectivity - i new grails. can please allow me know if necessary have net connectivity execute commands , such grails clean , grails compile ? no. , yes. here why: grails clean doesnt need connection @ all. cleans file on local directoy within project. and grails compile extent might needed if don't have refresh dependency successfully. as matter of fact older version grails after 2.3.x require net connectivity download references have used in buildconfig.groovy file. lead most of time grails refresh dependency ide /sts/ggts requires connection sync , download libraries maven repertoires or sort. any way, @ to the lowest degree need net @ first setting application, not @ none of grails compile , grails clean doesn't require that. grails

error handling - Expect Scripting - Raising Exceptions -

error handling - Expect Scripting - Raising Exceptions - im trying larn expect scripting run backend process, there way raise , grab error exception language? ex. python class="lang-py prettyprint-override"> try: raise exception("test") except exception, e: print e what's equivalent in expect? #!/usr/bin/expect bundle require expect # raise , grab exception if you're using tcl 8.6 (which expect bundle load nicely), literal translation of python code is: try { throw exception "test" } trap exception e { puts $e } now, try , throw commands added in 8.6 create sort of thing easier. prior (all way far farther can search conveniently) instead this: if {[catch { error "test" } e] == 1} { puts $e } which easy plenty in case, rather more error-prone 1 time things more complex. exception error-handling tcl expect

ios - NSMutableArray is empty when reaches numberOfRowsInSection and cellForRowAtIndexPath -

ios - NSMutableArray is empty when reaches numberOfRowsInSection and cellForRowAtIndexPath - i trying to pretty standard operation, basically, getting records form local sqlite database, getting additional info form web, merge info (which nsmutablearray) , display in table view. in viewdidload , array has required elements, in numberofrowsinsection: equals nil. because of this, cannot display items in tableview. set nil? give thanks help. code inboxviewcontroler.m // // articleviewcontroller.m // readlater // // created ibragim gapuraev on 09/06/2014. // copyright (c) 2014 sermilion. rights reserved. // #import "inboxviewcontroller.h" #import "loginviewcontroller.h" #import "shctableviewcell.h" @interface inboxviewcontroller () @end @implementation inboxviewcontroller @synthesize db, articles, response, jsondata; - (nsmutablearray* ) articles { if (!articles) { articles = [[nsmutablearray alloc] initwithcapacity:20];

serialization - Encoding nested JSON in Go -

serialization - Encoding nested JSON in Go - i've had lot of problem finding illustration of this. of info on net decoding json. i'd serialize info nested json, example: { "item": { "title": "items", "properties": [ { "num": 1, "name": "item 1" }, { "num": 2, "name": "item 2" } ] } } i know how marshal info flat struct, how set info struct can serialized nesting? http://play.golang.org/p/ndkmv1mytd i found tool generates struct json schema, don't understand how info sub structs. http://mholt.github.io/json-to-go/ type illustration struct { item struct { title string `json:"title"` properties []struct { num int `json:"num"` name string `json:"name"` } `json:"properties"` } `

python - Finding all links matching specific URL template in an HTML page -

python - Finding all links matching specific URL template in an HTML page - so lets have next base of operations url http://example.com/stuff/preview/v/{id}/fl/1/t/ . there number of urls different {id}s on page beingness parsed. want find links matching template in html page. i can utilize xpath match part of template //a[contains(@href,preview/v] or utilize regexes, wondering if knew more elegant way match entire template using xpath , regexes fast , matches correct. thanks. edit. timed on sample page. net connection , 100 trials iteration takes 0.467 seconds on average , beautifulsoup takes 0.669 seconds. also if have scrapy 1 can utilize selectors. data=get(url).text sel = selector(text=data, type="html") a=sel.xpath('//a[re:test(@href,"/stuff/preview/v/\d+/fl/1/t/")]//@href').extract() average time on 0.467 you cannot utilize regexes in xpath expressions using lxml , since lxml supports xpath 1.0 , xpath 1

node.js - Getting error installing nodejs when building from docker -

node.js - Getting error installing nodejs when building from docker - i trying install nodejs using docker console ubuntu error installing node js. error getting the command [/bin/sh -c ./configure && create && create install] returned non-zero code: 127 this part of dockerfile from ubuntu:12.04 run mkdir -p /dir/subdir run apt-get update # install nodejs add together http://nodejs.org/dist/v0.10.26/node-v0.10.26-linux-x64.tar.gz /dir workdir /dir/node-v0.10.26-linux-x64 run ./configure && create && create install workdir /dir exit code 127 typically means "command not found". chances build-essentials not installed. try adding next after apt-get update: run apt-get -y install build-essential node.js ubuntu docker

c++ - tic-tac-toe program in cpp not running -

c++ - tic-tac-toe program in cpp not running - i wanted implement tic-tac-toe in c++ using alpha beta pruning.i used link helping me out. http://www.ntu.edu.sg/home/ehchua/programming/java/javagame_tictactoe_ai.html i wrote code in c++.but not running. everytime computer gets turn,it returns position [-1,-1] has been set default in minimax function.i can't figure out bug is.please help. thanks. #include<iostream> using namespace std; enum player{ comp,user }; void print(); char grid[3][3]={{' ',' ',' '},{' ',' ',' '},{' ',' ',' '}}; int evaluateline(int,int,int,int,int,int); int evaluate(); int*move(); int*minimax(int,int,int&,int&); bool has_won(); void play(int); int main(){ play(user); } void print(){ for(int i=0;i<3;i++){ for(int j=0;j<3;j++) cout<<grid[i][j]<< " | "; cout<<"\n -- -- -- \n&quo

Error with Python sleep() command on http://rept.it -

Error with Python sleep() command on http://rept.it - i'm working on project involving sleep() command, (running 2.7.2) , it's throwing errors i've never seen before. here's test script wrote: from time import sleep print '1' sleep(2) print '2' it returns: >> 1 >> internal error: referenceerror: _select not defined any help appreciated time.sleep() uses select if available. reason have_select defined when python built, library can't found. from docs ... on other hand, precision of time() , sleep() improve unix equivalents: times expressed floating point numbers, time() returns accurate time available (using unix gettimeofday() available), , sleep() take time nonzero fraction (unix select() used implement this, available). ... from source: floatsleep(double secs) { /* xxx should test ms_windows first! */ #if defined(have_select) && !defined(__beos__) && !defined(__emx

java - Invoke a method on all subclasses from superclass? -

java - Invoke a method on all subclasses from superclass? - i have stubled upon has annoyed me. whenever want method invoked in classes have interface, or if extensions, have keyword opposite of keyword super. basically, want invocation passed downwards (if class inherits method, , method in superclass called, called in subclass well). there resembles asking for? edit: contemporary methods using efficient, not efficient them be. wondering if there way of invoking method, has been inherited, superclass/superinterface. lastly time looking this, did not find either. note: of subclasses unknown, hence impossible utilize. known class superclass, why can't invoke it. can solved using reflections api, using. however, not comply searching for. every method in java virtual exception of static methods, final methods , constructors meaning if subclass implements method beingness invoked, subclass's implementation called. if subclass wishes invoke immediate supercl

c - "Hacking: The Art of Exploitation": why does example program work with just gcc but not with -m32? -

c - "Hacking: The Art of Exploitation": why does example program work with just gcc but not with -m32? - the next code "hacking: fine art of exploitation" 2nd edition called input.c int main() { char message[10]; int count, i; strcpy(message, "hello, world!"); printf("repeat how many times? "); scanf("%d", &count); for(i=0; < count; i++) printf("%3d - %s\n", i, message); } this seems memory error(overflow) me since array message 10 bytes. however, when compile gcc , execute program, runs fine. when add together in flag gcc -m32 compilation process, abort trap 6 or errors signify wrong ( tried on personal mac , on college's linux computer cluster see whether there different. on latter, there more of explicit error of stack smashing memory map , backtrace, while mac there abort trap 6). anyway, here questions: why code work gcc , not gcc -m32 ? additionally

database - Should the "last updated" field be initialized to something? -

database - Should the "last updated" field be initialized to something? - i'm building rest api. my users have created_at , updated_at fields. these fields hold strings this: "2014-12-29t12:30:21+0000" when create user, set created_at current date. however, i'm not sure if should same updated_at . technically, user has never been updated. seems weird there not there. should leave value null , create same created_at , or else? creating updating state (from nil something) can safely considered "update". i set updated time on creation, if no other reason don't have cater null values (ever). database api rest date timestamp

Python fight game never ends -

Python fight game never ends - i can't find problems in game, other fact won't end. can't see wrong it. def fight(enemy, playerh, enemyh): #defining function fighting slay =true def testdeath(phealth, ehealth, enemy): #defining function test if player/enemy dead if phealth <= 0: slay = false print"you have lost fight, improve luck next time." elif ehealth <= 0: slay = false print"you have slain the",enemy,". win! congratulations!" else: slay = true #end of testdeath function print"you fighting a",enemy while slay: #while loop perform fighting playerd = randint(0,5) #making each characters harm using randint dragond = randint(0,7) trolld = randint(0,4) if enemy == "troll": enemyd = trolld elif enemy == "dragon": enemyd =

c++ - Circular Arc Through a Center Point -

c++ - Circular Arc Through a Center Point - i'm attempting render arc through 3 specified points in opengl. far i've managed compute of different values required (center , radius of circle passing through 3 points, , start , end angle). problem comes deciding on direction draw arc, clockwise or counter-clockwise, dependent on location of middle point. code follows: (hacky experimental code, points[0] start, points[1] middle , points[2] end) void render() { glclear(gl_color_buffer_bit | gl_depth_buffer_bit); glcolor3f(0.0f, 0.0f, 0.0f); // circle parameters point2d center = circlecenter(points[0], points[1], points[2]); double circleradius = radius(points[0], points[1], points[2]); // arc parameters double start = atan2(points[0].y - center.y, points[0].x - center.x) * (180 / m_pi); double middle = atan2(points[1].y - center.y, points[1].x - center.x) * (180 / m_pi); double end = atan2(points[2].y - center.y, points[2].x - center.x) * (180 / m_pi); if (start < 0)

Rails link_to update attribute from controller action -

Rails link_to update attribute from controller action - i want able have link when pressed updates 1 attribute based controller action. how able this? have create separate update route? new @ please bear me. controller def completed @meeting = meeting.find(params[:id]) if @meeting.day_of_meeting == @meeting.days @meeting.update_attribute(:day_of_meeting, '1') redirect_to :back else @meeting.increment! redirect_to :back end end model def increment! update_attribute(:day_of_meeting, day_of_meeting + 1) end view <%= link_to meetings_completed_path(@meeting), remote: true %> routes resources :meetings 'meetings/completed' end there several issues code since updating record need include method: :put in link , need modify routes file include appropriate route. in routes file add #routes.rb resources :meetings fellow member set 'completed' end end in view <%= link_to "mark comple

javascript - Knockout Computed Observable with parameters -

javascript - Knockout Computed Observable with parameters - is possible provide computed observable parameter? for example, this: var viewmodel = function(first, last) { this.firstname = ko.observable(first); this.lastname = ko.observable(last); var self = this; this.fullname = ko.computed(function(separator) { homecoming self.firstname() + ' ' + self.lastname(); }, this); }; and in html: <div data-bind="text: fullname(' - ')"></div> my actual utilize case far more complicated, i'm trying achieve, pass in value in html used part of computed function. failing there way create ordinary function takes parameters behave (computed) observable? you can create function, returns computed variable. can seek this. var viewmodel = function(first, last) { this.firstname = ko.observable(first); this.lastname = ko.observable(last); var self = this; this.fullname = function(separato

c++ - QTableView does not display database in release mode -

c++ - QTableView does not display database in release mode - i have written application in c++ using qt 4.8 in visual studio 2010 , seek create .exe dll s. seems work fine, when i run programme on computer without vs or qt installed there, nil gets displayed. //class create database databasemanager::databasemanager(): m_database(new qsqldatabase(qsqldatabase::adddatabase("qsqlite"))) { m_database->setdatabasename("virtualbank.db"); m_database->sethostname("localhost"); } // widget has holds qtableview database gets displayed corporationwidget { //.... qtableview * m_wgt; qsqlrelationaltablemodel* m_model; //.... } void corporationwidget::initializemodel() { setmodel(new qsqlrelationaltablemodel(this,*(getcontext()->model->getdatabase()))); //.... } normal view: (on computer) not normal view (on else's computer) the dll s in folder:

phonegap build - apigee tutorial for DreamWeaver Html5 -

phonegap build - apigee tutorial for DreamWeaver Html5 - does knows can find tutorial phonegap html5 apigee? it's because i'm wrinting application in dreamweaver/html5 deployed phonegap ios/android found tutorials ios/xcode , android/java bu need 1 both. any ideas? thank this blog/video can guide in endeavor. https://blog.apigee.com/detail/build_a_store_locator_app_with_html5_phonegap_an_api_based_backend_webcast_recording girish html5 phonegap-build apigee

oop - PHP - Is there a way to initialize a class and call a non-static method in one line? -

oop - PHP - Is there a way to initialize a class and call a non-static method in one line? - can point me in right direction minimize these 2 lines of php single line? $foo = new foo; $x = $foo->getbar(); i've tried following, didn't desired result.. $x = new foo()->getbar(); also, possible in yii, using cmodel object: $x = foo::model()->getbar(); is effect achievable in non-framework php without model() static method? it's possible 5.4 $x = (new foo())->getbar(); php oop

java - JPA merge foreign key lost -

java - JPA merge foreign key lost - i'm new jpa hibernate implementation , i'm trying understand how entitymanager.merge works. have next scenario of 2 classes @manytoone relation e.g class a{ private string name; ........ get... set... } class b{ private string name; @manytoone(fetch=fetchtype.lazy, cascade=cascadetype.merge) private a; ........ get... set... } and have gui can view , alter b property's - class not loaded , there no open session in view. when trying save(merge) changes in back-end: entitymanager.merge(b); //the object "b" created view has "a" set null in database in table b foreign key relationship(referencing table a) lost - set null; not want want maintain relationship , merge-save changes made in gui object b out losing many-to-one relationship maybe i'm expecting not possible , need is: dbb b = entitymanager.find(b.class, id); dbb.setname(b.getname()); dbb.set........

html - Iscroll inside Iscroll - nested iscroll unexpected behavior -

html - Iscroll inside Iscroll - nested iscroll unexpected behavior - i have 2 lists utilize iscroll vertical scrolling. the sec list inside first list. when scroll sec list first list scrolling. want when scroll within list (the sec list) main list (the first list) not scroll. how can that? here example: <div id="wrapper" style="overflow: hidden;"> <div id="scroller"> <ul id="thelist"> <li>pretty row 1</li> <li>pretty row 2</li> <li>pretty row 3</li> <li>pretty row 4</li> <li>pretty row 5</li> <li>pretty row 6</li> <li id='inwarper'> <div id="scroller"> <br/> <ul> <li>pretty row 1</li> <li>pretty row

mysql - Insert Statement with result record values -

mysql - Insert Statement with result record values - i have table 50 columns, , table has more 1 lakh records. requirement few desired records table , insert machine's database table. is there way extract desired result records along insert statement? tried doing exporting data, fetches records. any suggestions please? mysql

javascript - Toggle menu with Jquery not working -

javascript - Toggle menu with Jquery not working - i want create toggle menu jquery in page: http://propertymanagementoh.com/new-short-header-page/ .there menu in right top. want create toggle when click on "menu ☰" button menu appear , 1 time again when click on button disappear(like this: http://www.titleonemanagement.com/ ). have written next code not working: <script> $(document).ready(function(){ $("#block-37").click(function(){ $("#block-38 .menu").toggle(); }); }); </script> also used next css: #block-38 .menu{ position:fixed; top:0; right:0; width:250px; overflow:hidden; z-index:999999; } there 2 jquery scripts beingness used, meaning jquery.noconflict(true) causing issue sec set of jquery instructions. advised user combine scripts , worked! :) additional help per comment: few things need done assist this. 1) in css add together this: #block38 .nav-vertica

arrays - How to show label or textbox made by coding in c# -

arrays - How to show label or textbox made by coding in c# - let me explain how programme : 1.i have textbox1 user input number 2.i have button1,where store number textbox1 int max here's coding private void button1_click(object sender, eventargs e) { max = int.parse(textbox1.text); fun = new textbox[max]; (int = 0; < max; i++) { if (i > 0) { y = y + 26; } fun[i] = new textbox(); fun[i].location = new system.drawing.point(44, y); fun[i].text = "test"; } } now problem won't appear @ all,because don't know code create appear on form itself. if understand correctly want dynamically create controls , display in form? looks code okay, need add together controls form display in form. code may help you. int y = 26; var max = int.parse(textbox1.text); var fun = new textbox[max]; (int = 0; < max; i+

C/C++ reading line at a time -

C/C++ reading line at a time - i trying solve programming problem of site , 1 had next statement: read string , parse number, char 'l' can considered number 1 , chars 'o' , 'o' can considered number 0, commas , spaces accepted in input ignored, if other character found output error... so... since there can spaces in lines, used gets (the documentation says removes new line , puts terminator)... my sequence of if test if number, if acceptable letter, checks if not comma or space... , found out entering in lastly if though there wasn't character should lead there changed printf within print printf("%d error", st[k]); and outputs 13: carriage return... tried compiler here #include <cstdio> #include <cstring> #include <cstdlib> int main() { char st[100]; char buf[100]; int k, i; long long int num; ops: while(gets(st)) { for(k = = 0; st[k]; k++)

Curious "compile" function in angularjs directive -

Curious "compile" function in angularjs directive - the total code in here of plunker when remove compile: function (telement, tattrs, transclude) function, functionality ok app.directive('whatisinthese', ['$compile', function($compile) { homecoming { restrict: 'a', compile: function (telement, tattrs, transclude) { // compile function curious , hard explain // have nil here }, link: function(scope, elem, attrs) { scope.gettesturl = function() { homecoming "test.html"; }; var these = attrs.whatisinthese.split(' '); var html = '<div ng-include src="gettesturl()"></div>'; var el = angular.element(html); var compiled = $compile(el); elem.append(el); compiled(scope); } }; }]); can explain why happen? as mentioned in documentation of angularjs the compile function deals transforming template dom.[...] link property

java - JtextPane with a touch interface -

java - JtextPane with a touch interface - i'm developing touch based windows 7 app using tuio client-server setup , touch library extends multitouch 4 java. 1 of functionality i'm struggling enable text highlighting when using touch. display simple txt file using jtextpane display text, highlighting done through drag action. clicked position drag event starts , when stops , tried convert coordinates text panel's space different values ones should have, before actual text. the code i'm using display document following: //create jdialog container of window = new jdialog(parent); window.setundecorated(true); //create jtextpane text = new jtextpane(); text.setpage(newfile.touri().tourl()); text.seteditable(false); text.sethighlighter(null); //scrollpane used display text jscrollpane scroll = new jscrollpane(text); scroll.setpreferre

c# - How do I build this EF relationship? -

c# - How do I build this EF relationship? - i can in database want understand how code-first. i have class: public class component { public guid id { get; set; } public guid name { get; set; } public virtual component master { get; set; } public virtual icollection<component> components { get; set; } } a component can have many kid components. component can kid component in many other components. i want create table relates component's id's together. best way represent this? when have self referencing entity can have single parent: public class component { public guid id { get; set; } public guid name { get; set; } public virtual component master { get; set; } public virtual icollection<component> components { get; set; } // reference parent guid (if any) public guid? masterid { get; set; } } to configure entity relationship in onmodelcreating: protected override void onmodelcreating(dbmodel

javascript - Adding Custom Control to Google Map (Adding toggle for traffic layer) -

javascript - Adding Custom Control to Google Map (Adding toggle for traffic layer) - i trying add together google maps traffic layer control, , since new this, cannot figure out. have gotten below script net fine tuning, cannot figure out how command map. need way toggle traffic layer on , off average user, if there improve way add together command map, anything. thanks. var map; var chicago = new google.maps.latlngbounds(); function homecontrol(controldiv, map) { controldiv.style.padding = '5px'; var controlui = document.createelement('div'); controlui.style.backgroundcolor = 'white'; controlui.style.borderstyle = 'solid'; controlui.style.borderwidth = '2px'; controlui.style.cursor = 'pointer'; controlui.style.textalign = 'center'; controlui.title = 'click set map home'; controldiv.appendchild(conrolui); var controltext = document.createelement('div'); c

oracle - ColdFusion - Duplicate POST Being Fired -

oracle - ColdFusion - Duplicate POST Being Fired - i have unusual thing happening , cannot seem track down. have simple cfm simple form, user presses submit button, page posts , calls chlorofluorocarbon function <cfinvoke> . function beingness invoked has single <cfstoredproc> phone call oracle. oracle procedure supposed create around 3,000+ records. it's creating double amount. set <cflog> right before <cfstoredproc> phone call , there 2 entries beingness created. function beingness fired sec time somehow. same user, same sessionid, different threadid. have no thought sec phone call coming from. i pressing button once. i watched network traffic, see 1 post. i set <cflock> around <cfstoredproc> phone call , fixed problem, 3000+ recs created. lock timeout error mysterious sec call. another unusual thing <cflock> has timeout of 30 seconds. <cflog> shows 1 entry initially, 60 seconds later sec

c - Calling Struct to main function from header file -

c - Calling Struct to main function from header file - i have 2 header files , main program. header files data.h , flight.h . main programme calculateflight.c . the info header file has set of typedef structs contains variables required programme run. i have created headerfile named flightmodel.h contains following: #ifndef __flight_model_h #define __flight_model_h #include "data.h" void calculateflight(speedparamstype *speed, spinparamstype *spin, flightparamstype *fdata); #endif the data.h contains typedef struct s like typedef struct { float totalspin; float spinaxis; float backspin; float sidespin; } spinparamstype; there no errors in struct variables , don't know how phone call struct within main function. void main() { speedparamstype speed; spinparamstype spin; flightparamstype fdata; speed.totalspeed=200.0f; speed.launchangle=30.0f; speed.horizontalangle=5.0f;

c++ - GDB conditional breakpoint syntax error -

c++ - GDB conditional breakpoint syntax error - i trying figure out why c++ programme failing assertion. want analyze current variable values @ time of failure, programme exits when assertion fails , scope lost. hence want set conditional breakpoint assertion status negated. assertion looks this: assert( addrrange(pkt->getaddr(), pkt->getaddr() + pkt->getsize() - 1).issubset(range) ); in gdb, do: break filename.cc:linenum if (addrrange(pkt->getaddr(), pkt->getaddr() + pkt->getsize() - 1).issubset(range) == false ) but results in: a syntax error in expression, near `pkt->getaddr(), pkt->getaddr() + pkt->getsize() - 1).issubset(range) == false )'. i tried creating breakpoint first , using cond, same syntax error. doing wrong? i ended modifying code , saving function phone call homecoming value bool, , creating conditional breakpoint using bool variable instead. c++ debugging gdb assert

asp.net - OleDb Exception in c# “No value given for one or more required parameters.” while trying to Select Data from Access database -

asp.net - OleDb Exception in c# “No value given for one or more required parameters.” while trying to Select Data from Access database - i have next code: public datatable opencon(pal.property objpal) { string query = "select userid,firstname,usertype tbl_user_login username=@username , password=@password , status=1"; oledbcommand objcmd = new oledbcommand(); objcmd.commandtext = query; objcmd.connection = oldbcon; oldbcon.open(); objcmd.parameters.add("@username", oledbtype.varchar).value = objpal.username; objcmd.parameters.add("@password", oledbtype.varchar).value = objpal.password; datatable dt = new datatable(); oledbdataadapter adp = new oledbdataadapter(objcmd); adp.fill(dt); homecoming dt; } here want fetch values table according condition, when run code shows next error: even though passed right parameters value in @username , @passwor

sockets - Can't read data from bluetooth medical device and android -

sockets - Can't read data from bluetooth medical device and android - i want connect android app pulse oximeter (sat 300 bt), i'm encountering problems when phone call inputstrem.read(), method never returns (i know blocking read), think because medical device never gives me inputstream. i've read device needs receive output message before send messages client, if case, don't know message send. this code i've: public class bluetoothactivity extends baseactivity { private static final string tag = "bluetoothactivity"; private static final boolean d = true; private bluetoothadapter bluetoothadapter; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); bluetoothadapter = bluetoothadapter.getdefaultadapter(); if (bluetoothadapter.isenabled()) { set<bluetoothdevice> devicesavailable = bluetoothadapter.getbondeddevices(); if (device

javascript - How to show initial-scale 1.0 to devices below 570px width only -

javascript - How to show initial-scale 1.0 to devices below 570px width only - on website, have mobile version devices below 980px, devices blow 570px see , if rotate mobile device, them able see total site device scaling if needed. change pages width see mobile version. want devices see on portrait mode in landscape them see total version. thought implementing tilt detection, nowadays can 27" all-in-one touch computers can tilt! if don't have viewport tag included, page render using device resolution. means homecoming 980px not css pixels you're expecting. default value of mobile browsers (on android , ios devices @ least). so, trying add together viewport tag checking if width of window less 570px without having viewport content tag set "width=device-width" fruitless. why first effort did not work. also, if seek , remove viewport tag after page rendered (for instance, within $(document).ready(function () {}); remove tag, page unaffecte

php - Symfony : detect link inside textarea -

php - Symfony : detect link inside textarea - i trying observe links within textarea , display in view. so tried these preg_replace instructions preg_replace("/([\w]+:\/\/[\w-?&;#~=\.\/\@]+[\w\/])/i","<a target=\"_blank\" href=\"$1\">$1</a>",$detail); preg_replace('@(http)?(s)?(://)?(([a-za-z])([-\w]+\.)+([^\s\.]+[^\s]*)+[^,.\s])@', '<a target="ref" href="http$2://$4">$1$2$3$4</a>', $detail); and it's done great on whole except when got url containing special character follow : http://website.info/x-y-z-a/~~~~dcvvvc|cvvcvc~~~/cvcvcv-5-1.html. then it's not working @ all. thanks you encode url before running regex in order turn special characters % equivalent. see http://php.net/manual/fr/function.urlencode.php php regex

c# - Filename with a hash and Uri LocalPath handling -

c# - Filename with a hash and Uri LocalPath handling - i'm coding in c# , i've uri file (that can unc, web served, etc, that's why need utilize uri) , ran in case uri pointing file containing # in name. the uri interpreted fragmented 1 uri.fragment not empty , uri.localpath broken, points hypothetical location denoted uri hash. is there way create uri class "understand" # part of filename? if not, how handle nicely because fragment in case contains farther special characters (kanjis) , gets escaped, simple string operations not sufficient. you can utilize system.uribuilder class. uribuilder builder1 = new uribuilder("http://yourdomain.com/"); builder1.path = @"hello world#シンガポール国.txt"; uri url1 = builder1.uri; system.diagnostics.debug.writeline(url1.tostring()); // -> http://yourdomain.com/hello world%23シンガポール国.txt system.diagnostics.debug.writeline(url1.localpath); // -> /hello world#シンガポール国.txt in case,

javascript - Errors doing socket.io chat example node.js -

javascript - Errors doing socket.io chat example node.js - just started larn node.js multiplayer capabilities: using windows 7, npm install node.js , components had few issues making me mad var io = require('socket.io')(http); was throwing error: d:\projects\node\chat\index.js:3 var io = require('socket.io').(http); ^ syntaxerror: unexpected token ( @ module._compile (module.js:439:25) @ object.module._extensions..js (module.js:474:10) @ module.load (module.js:356:32) @ function.module._load (module.js:312:12) @ function.module.runmain (module.js:497:10) @ startup (node.js:119:16) @ node.js:901:3 some time more wiered unable handle or no such method defined, etc. on client side in browser next script not working <script> var socket = io(); $('form').submit(function(){ socket.emit('chat message', $('#m').val()); $('#m').val('');

php - mysql_fetch_array is getting one value on my query -

php - mysql_fetch_array is getting one value on my query - i trying print list of info mysql table, , want print info table related first table. first list okay, sec printing lastly row of data. $queryfunc=mysql_query("select * title"); foreach ($func $funcc){ $iddd=$funcc[0]; $funcao=$funcc[1]; echo "<li class='has-sub'><a><span>" .$funcao. "</span></a>"; at point, have total list of info first table. need take id of row of first list, , print next info related id: $newq=mysql_query("select nome utilizadores title=$iddd"); $namm=array(); while ($rowww=mysql_fetch_array($newq)) $namm[]=$rowww; foreach ($namm $nomi){ $nee=$nomi[0]; echo "<ul><a href='php/curriculo.php?nomeut=$nomes' target=_blank>" .$nee. "</a></ul>"; } } here, printing lastly result table. thanks php mysql

Apart from Union , Union all and Pivot in MS- Sql server can I combine two columns into one column -

Apart from Union , Union all and Pivot in MS- Sql server can I combine two columns into one column - i having result set col1: col2 b c d i want result set a b c d without using union, union , pivot. select t.x table cross apply ( values (col1), (col2) ) t(x) sql sql-server sql-server-2008

html - fullwidth slider bootstrap -

html - fullwidth slider bootstrap - i m having here little problem. im using bootraps template carousel , have slider there in total width , not minimized. how can alter this <div id="mycarousel" class="carousel slide" data-ride="carousel"> <!-- indicators --> <ol class="carousel-indicators"> <li data-target="#mycarousel" data-slide-to="0" class="active"></li> <li data-target="#mycarousel" data-slide-to="1"></li> <li data-target="#mycarousel" data-slide-to="2"></li> </ol> <div class="carousel-inner"> <div class="item active"> <img data-src="holder.js/900x500/auto/#777:#7a7a7a/text:first slide" alt="first slide"> <div class="container"> <div class="carousel-caption">

c# - Watin don't update button after select option in list -

c# - Watin don't update button after select option in list - i seek select 1 alternative in next html : <select class="gwt-listbox" style="" gwtdebugid="signup-flow-choose-timezones"> <option value="">ahora seleccione una zona horaria:</option> <option value="">------</option> <option value="pacific/honolulu">(gmt-10:00) hora de hawai</option> <option value="america/anchorage">(gmt-09:00) hora de alaska</option> <option value="america/los_angeles">(gmt-08:00) hora del pacífico</option> <option value="america/denver">(gmt-07:00) hora de las montañas rocosas</option> <option value="america/phoenix">(gmt-07:00) hora de las montañas rocosas - arizona</option> <option value="america/chicago">(gmt-06:00) hora central</option> <option value

Python print regex in json string -

Python print regex in json string - so, i'm using little python script seek print out every occurrence of website 'northwest.hall.' wildcard() number, in big json string pulled url. i have far: import urllib, json, re url = 'http://graphite.website.com/render/?target=stats.web.northwest.hall.*&format=json' response = urllib.urlopen(url) info = json.loads(response.read()) code = re.findall('northwest', data) print code this should homecoming list of 30 regexpressions of northwest.hall.number in json string beingness parsed, next error instead: traceback (most recent phone call last): file "/users/arin/desktop/scripts/code_parser2.py", line 7, in <module> code = re.findall('community', data) file "/system/library/frameworks/python.framework/versions/2.7/lib/python2.7/re.py", line 177, in findall homecoming _compile(pattern, flags).findall(string) typeerror: expected string or buffe

javascript - d3 handling mouse events in charts -

javascript - d3 handling mouse events in charts - i trying create interactive pie chart reacts mouse clicks. @ moment made possible tooltip come 1 time pie piece clicked on. how can create disappear if user clicks 1 time again on same slice? .on("click", function(d) { tooltip.transition() .duration(450) .style("opacity", 0.7); tooltip.html("<b>" + d.name + ": " + d.value + "</b>") .style("left", (d3.event.pagex) + "px") .style("top", (d3.event.pagey-20) + "px"); }); if info in selection objects, can store within each datum whether it's selected or not. example, .on("click", function(d, i) { if (!d.selected){ tooltip.transition() .duration(350) .style("opacity", 0.9); tooltip.html("<b>"

c# - Adjusting Unicode based on user input -

c# - Adjusting Unicode based on user input - i'd display e^x = answer in label on windows form, using appropriate superscript rather ^x . x user's input text box, reply math.exp(x) . of variables declared , calculations done after user clicks e^x button (it's simple calculator application). unicode superscript 4-9 \u2074 \u2079 . realized superscript 2 , 3 follow different pattern, i'll worry later i've been trying various ways concatenate \\u207 , x variable result displayed on label either \u207x or system.char[] is there way i'm trying accomplish? or approaching wrong way? this not work standard label. refer question how using htmlrenderer how add together superscript powerfulness operators in c# winforms c# winforms unicode