Posts

Showing posts from August, 2013

sql server - SQL: How to CONCAT value -

how can return values of mainemail in query below, delimited commas , still count mdcselect? declare @mainhospital varchar(50)='hospital 1' select distinct mainhospital , f.item, count(*) count surveypiclist s cross apply splitstrings(s.mdcselect,':') f mainhospital = @mainhospital group mainhospital, f.item order count desc to clear above returns this: http://i.imgur.com/f1opu6p.jpg so there 3 separate entries/people selected "02-eye". want list out emails(mainemail) comma delimited. please let me know if unclear. assuming use of cross apply using sql server, , @ least version 2005, can use xml concatenation follows: declare @mainhospital varchar(50)='hospital 1'; select mainhospital , f.item, count(*) count ,stuff( (select distinct ', ' + m.mainemail surveypiclist m m.mainhospital = @mainhospital , ':' + m.mdcselect + ':'

c# - Clear/delete & refresh button wpf -

i have made delete/clear button works, after using cannot make new search...i have refresh button doesn't work @ all. want able make ned search , thought use refresh button this. can me? if can, please explain me example. private void button_click(object sender, routedeventargs e) { datagridtest.itemssource = null; } private void refresh_click(object sender, routedeventargs e) { datagridtest.items.refresh(); } there's part of code need see can able help. if working wpf, wpf awesome mvvm design pattern. you can check start here . josh smith's tutorial best tutorial mvvm.

java - Find disjoint set irrespective of case of the strings -

i using collection.disjoint find disjoint set of 2 string collections c1, c2. not ignore cases, example - string str different str . return collections.disjoint(c1, c2); can find disjoint of both collections ignoring cases without using loop? if absolutely insist no for loop used, can find disjoint between 2 collection s of lowercased string s. using google guava , should like: package ru.zombator.stackoverflow; import java.util.arrays; import java.util.collection; import java.util.collections; import java.util.locale; import com.google.common.base.function; import com.google.common.collect.collections2; public final class disjointignorecase { public static void main(string[] args) { collection<string> coll1 = arrays.aslist("donald", "duck"); collection<string> coll2 = arrays.aslist("donald", "donut"); collection<string> coll3 = arrays.aslist("homer", "donut&qu

windows - Batch file giving File Not Found error -

been working on systematic file search script retrieve name of documents in directory, , sub directories contain determined search string. essentially, log search results. nice have search file names, that's not yet important. code: @echo off echo - search files in current directory, , subdirectories. echo - ignore case sensitivity. echo - search term within readable documents. set /p searchfilter=search filter: set results=%cd%\results.txt echo searching... echo results: > "%results%" /f "usebackq tokens=*" %%i in (`dir /s/b/a:-d/o:e`) ( find /i "%searchfilter%" "%%~nxi" >nul && echo %%~nxi >> "%results%" ) echo search complete. pause run-down: system requests string user. then, system saves handle results file (thought fix problem, didn't). system filters files, excluding folders, directory, , sub directories, printing bare name of file (with extension), proceed scan each file search string,

c - Stable text feed for vim through vimserver -

i searching highly stable way feed text (output of program) vim through vimserver. assume have started (g)vim session gvim --servername vim myfile . file myfile contains (unique) line out: marks position text should pasted. can straight forwardly achieve commandline vim --servername vim --remote-send ':%s/out:/text\\rout:/<enter>' . can repeatedly feed more text using same command. inside c-program can execute system() . text dynamic , arbitrary (received stream in c-program) needs passed on command line , hence needs escaped. furthermore using replacement command %s vim jump position text inserted. find way paste large chunks of arbitrary text seamlessly in vim. idea have vim read posix pipe :r pipe , write the string within c-program pipe. ideally solution such can continuously edit same file manually without noting output added @ out: long location outside visible area. the purpose of text feed create command line based front end scripting languages. block

Wordpress not reading custom css? -

i'm using woocommerce theme called "mystyles", til every change i've made in custom.css file has worked, reason today no matter change make isn't working! i've edited css of site within browser using devtools chrome , it's worked once upload actual website reverts old css few days ago. don't understand! i've tried uploading both ftp , in-wordpress editor, double checked make sure changes uploaded re-downloading file , found nothing wrong. checked in different browsers, cleared caches, it's driving me insane. ideas? website www.bettinasboutique.com it's in process of being set (if can figure poop out). have of had problem wordpress not accepting changes css? i've tried making changes html files, text in nav bars spot causing me trouble, , it's worked fine! it's css. i've tried uploading custom css original stylesheet file instead of custom css file , still reads old nav styles. please help!

php - Using external XML uri with variables -

i searched here , on big g, willing learn, didn't found answer yet. i trying transform external xml data xslt read in html or php. tested few things , transformed simple xml files xsl , php. problem actual xml files need use not typical dot xml files see, more format " http://webservices.nextbus.com/service/publicxmlfeed?command=vehiclelocations&a=sf-muni&r=14&t=0 ". when use these addresses, seems read these files , xsl stylesheet, parse correct numbers of table cells, return them empty. what's wrong? also, can related xml formatting used external site? noticed xml more "xhtml styled" rather other files seen in past. their style using 1 big tag , closed slash: <vehicle id="5464" routetag="14" dirtag="14_ib2" lat="37.7637" lon="-122.4087" secssincereport="86" predictable="true" heading="218" speedkmhr="0"/> the same example, if writting

c# - Set ContentPlaceHoderId from code behind? -

am using master pages specific page ( before login , after login).i dynamically managed set 2 different master pages specific page...but stil have set contentplaceholder dynamically code behind....is possible? if yes? how be? the best way you should create user control (before login , after login ) and set user conterol according session in code behind. contentplaceholder placeholder = page.master.findcontrol(“contentplaceholder1″) contentplaceholder; by getting placeholder can ever want add new control or find control in placeholder,etc.

redirect - PHP project links being redirected to the wamp server page -

my apologies if has been posted i've created php project , i'm using wamp i've got database set in phpmyadmin. i able run website , view website, when click on link (my catalog different categories link display products) . link redirects me wamp server page. does have solution this, appreciated. code: <a href="/?page=catalogue-item&amp;category=<?php echo $category['id']; ?>&amp;id=<?php echo $row['id']; ?>"> <img src="<?php echo $image; ?>" alt="<?php echo helper::encodehtml($row['name'], 1); ?>" width="<?php echo $width; ?>" /> </a> thanks in advance! try this: <a href="?page=catalogue-item&amp;category=<?php echo $category['id']; ?>&amp;id=<?php echo $row['id']; ?>"> <img src="<?php echo $image; ?>" alt="<?php echo helper::encodehtml($row['

ruby on rails - export to excel french character -

i have following method on on action export excel list of user: def users_report @users = kid.where(confirmation_token: nil).paginate(:page => params[:page], :per_page => 30) @userxls = kid.where(confirmation_token: nil) respond_to |format| format.html format.xls { send_data @userxls.to_csv({col_sep: "\t"}) } end end on model to_csv method: def self.to_csv(options = {}) csv.generate(options) |csv| csv << ["name", "surname", "e-mail", "age", "school", "class", "native language", "practised language", "conversations same native", "convserations different native", "message same native", "message different native", "posts", "clossed/finished calls", "missed calls", "connections per week", "nb of foreign friends", "nb of friends same country",

java - How to translate this javascript code which uses array of functions binded and recursively called inside -

it's written in javascript started translating java, got stuck don't see other way this. i make initializelcdcontroller getlinecontrol(int index) not use function binded arrays method. public void initializelcdcontroller() { long = 0; while (a < 154) { if (a < 143) { linecontrol[a] = function () { if (lcdticks < 80) { scanlinemode2(); } else if (lcdticks < 252) { scanlinemode3(); } else if (lcdticks < 456) { scanlinemode0(); } else { lcdticks -= 456; if (stattracker != 3) { if (stattracker != 2) { if (stattracker == 0 && mode2triggerstat) { interruptsrequested |= 2; } incrementscanlinequeue(); }

java - spring-webflow jars not available -

Image
i have wasted 4 hours on finding reason not adding of webflow jars tp reference library of my modular maven project generated appfuse.i want add webflow project. when registering below, error (i have still not run project). error is multiple annotations found @ line: - class 'org.springframework.webflow.mvc.servlet.flowhandleradapter' not found but have included webflow dependencies in pom in web module project. when go the reference library can not find webflow jars well. think reason this, can not wind way jars in reference library. the generated pom lengthy. add if needed. <dependency> <groupid>org.springframework.webflow</groupid> <artifactid>spring-webflow</artifactid> <version>2.3.2.release</version> </dependency> is there compatibility issue spring versions. using 4.0.0.release have changed 4.0.2.release well. no luck. can not find meaningful solution t

c# - file replication using asp.net webform -

i have 2 servers , need replicate file. if upload file server 1 file should replicated server 2 automatically , if delete file file should deleted other server. got idea can use wcf how don't know. how can it? so can done in many ways raging dropbox ( developers reference ) dfs replication in windows server ( dfs sync blog ). can ofcourse use wcf or of other ways exist upload files server including nancy , other lightweight frameworks (owin, kayak, firefly..) if choose path need write upload, remove, sync code each action system need handle , while do-able not seem effective ways, perhaps have other needs not explained in original post? search on topics, try implement , if stuck feel free return stackoverflow code , questions.

javascript - change backgroung colour of div when button is pressed -

Image
i designing ui & here not able format properly. 2 things not able :-- left-1, left-2, left-3 .. text comming @ bottom of button image. want them come @ right of image ? whwen ever press button on left possible change background colour of in image & text (i.e left-1 & left-2) placed ? how can acive this. code :-- <!doctype html> <html style="height: 100%;"> <head> <style> body, html { width:100%; height:100%; margin:0; padding:0; position:relative; } .input { display: inline-block; padding: 0 2px; } .input input { display: block; } .imgtxt { margin: 0; font-family:arial; color:#dddfed; font-size:15px; } #images { background-color:#888686; white-space:nowrap; } div.scrollable { width: 100%; margin: 0; padding: 0; overflow: auto; padding-left: 4px; padding-top: 20px; box-sizing:border-box; } div.scrollablemenu { width: 100%; margin:

facebook - Find the topic of a query -

given question, like, current or mouse... possible know topic question belongs to? trying write app, scan through user's friends list(on facebook, twitter, g+..., hope not more 2 levels) , given question try find person may able provide answer. to that, question , topic of question needs found. if there service provider similar service, starter. i tag question better. help? hope have found answer right here... stack exchange api list starter. of course more analysis on response required, start one, far have read. let me try now.

Excel VBA script on formatting shapes -

i making interactive map, 2 sheets. first sheet map sheet line shapes, second database. i add colouring function according line shapes based on values in database. i've made plan easier undertanding can found here: http://www.speedyshare.com/gwjwd/plan.xlsm here code i've tried: if target.address = sheets("data").range("$c$4:$c$9") select case target.value case = 10 sheets("map").shapes(cl.value).line.forecolor.rgb = vbred case = 20 sheets("map").shapes(cl.value).line.forecolor.rgb = vbblue case = 30 sheets("map").shapes(cl.value).line.forecolor.rgb = vbgreen end select end if

svn - Can't push git commit to remote branch after stg import -

i can't seem commit change in local branch remote branch. the local branch (26f) tracking remote branch (origin/fixes/0.26) on github via ssh. i imported change using stg import commited fix local branch shown git status: git status # on branch 26f # branch ahead of 'origin/fixes/0.26' 1 commit. # (use "git push" publish local commits) # nothing commit, working directory clean but, when run git push, says there nothing push: git push up-to-date per "tracking branches" section of http://www.git-scm.com/book/en/git-branching-remote-branches git push should work states "if you’re on tracking branch , type git push, git automatically knows server , branch push to" was getting error git 1.7.3.4. have upgraded 1.8.3.2 , seeing same problem. so appears have worked: git push git@github.com:me/it.git 26f:fixes/0.26 but still seems contradict "tracking branches" section of http://www.git-scm.com/book/en/git-b

actionscript 3 - Equivalent to moveReceived in ElectroServer 5 -

i working on proprietary game project , updating legacy code actionscript 1 actionscript 3. in particular, lot of game code previous iteration implemented using electroserver api method movereceived. api provides following description method: movereceived: availability flash player 6. usage electroserver.movereceived(type,object,from) parameters type either "public" or "private" (object) object object sent (object) from name of user sent move (object) returns nothing. description event fired when move received. can send , receive actual actionscript objects using sendmove , moverecieved. makes creating multiplayer games simpler. example the following example of move seen in game characters can jump , shoot. function movereceived(type:string, ob:object, from:string) { if (type == "private") { var action:string = ob.action; if (action == "shoot") { var x:number = ob.x; var y:number = ob.y; var ang

angularjs - AngularUI - Accordion trigger a method inside the template using ng-click -

i'm using angularui bootstrap library templates. i'm wainting call custom method inside template , wondering need in order working? guess i'm wanting replace ng-click="isopen = !isopen" own custom method if possible. thanks in advance. <div class="panel panel-default">\n <div class="panel-heading">\n <h4 class="panel- title">\n <a class="accordion-toggle" ng-click="isopen = !isopen" accordion- transclude="heading">{{heading}}</a>\n </h4>\n </div>\n <div class="panel-collapse" collapse="!isopen">\n <div class="panel-body" ng-transclude></div>\n </div>\n</div> since clicking on toggle changes value of isopen , can watch , apply logic without changing ng-click attribute $scope.$watch('isopen', function(value) {

java - writing instance methods -

i'm practicing writing instance method converts natural number integer. i following tutorial online , came code below. when compile, keeps adding " this " code compiles , gives me expected output i'm getting few warning messages. " this.i " correct syntax when creating instance method? private naturalnumber i; public int toint() { int result = 0; if (!(this.i.iszero())) { int d = this.i.divideby10(); result = this.i.toint() * 10 + d; this.i.multiplyby10(d); } return result; } whenever call internal fields or methods of object, keyword this , if not explicitly present, implied, referring object itself. more details can found in java documentation, e.g. oracle : using keyword so, this.i means "variable i in this object". of course,, i must have value assigned before invoking of methods this.i.iszero() , otherwise run-time error ( nullpointerexception ) occur. ide may warn agains

java - In Android App,I Need Pdfviewer Jar For Viewing pdf,AnyOne Can Help me? -

here,i open pdf raw folder,,,and use jar of pdfviewer,but problem is..viewing of pdf..i want open big size,and open in small size.. uripdf = "android.resource://" + getpackagename() + "/" + r.raw.knowhindi; final intent intent = new intent(); intent.setaction(android.content.intent.action_view); intent.setdataandtype(uri.parse(uripdf), "pdf/*"); intent.setclass(getapplicationcontext(), second.class); startactivity(intent); mupdf library better option; http://mupdf.com/docs/how-to-build-mupdf-for-android

pagination - Cypher SORT performance -

i'm trying accomplish pretty common task. have substantial dataset in neo4j database and, restful web service, want return data in chunks of 25 nodes. model quite simple: (:tenant {hash:''})-[:owns]->(:asset {hash:'', name:''}) i have unique constraints on hash properties on both labels. if wanted obtain 101th data page, cypher query this: match (:tenant {hash:'foo'})-[:owns]->(a:asset) return order a.hash skip 2500 limit 25 my dataset consists of single tenant, ~75k assets. above query takes ~30(!) seconds complete. notice further advance in data (ie. higher skip ) longer takes query return. i figured out culprit of performance issues order a.hash . when remove it, query returns sub-second results. quite surprise, i'd expect index ordered. obviously, in order implement sensible pagination, must have consistent sort order. any tips on making query perform? alternative suggestions paging? can see adding dedicated page

mysql - Secure JSF Applicattion (Login) with Glassfish -

i'm trying secure jsf application. using jdbc mysql connection. password hashed using sha-256 function. j_security_check redirecting me error.xhtml page. username: admin password: admin this mysql database tables: drop table if exists `group`; create table `group` ( `groupname` varchar(45) not null, `useranme` varchar(45) not null, primary key (`groupname`,`useranme`), key `user_group_fk_idx` (`useranme`), constraint `user_group_fk` foreign key (`useranme`) references `user` (`username`) on delete no action on update no action ) engine=innodb default charset=utf8; insert group values ('admin','admin'); drop table if exists `user`; create table `user` ( `username` varchar(45) not null, `password` varchar(256) not null, `name` varchar(45) default null, `timestamp` datetime default null, primary key (`username`) ) engine=innodb default charset=utf8; insert `user` values ('admin','8c6976e5b5410415bde908bd4dee15dfb167a

c# - Why xls opens while/after reading it from code? -

i have tool parsing excel files. user chooses xls/xlsx read, tool creates copy of in temp random name, parses copy. relevant part of code: string sourcefile = textbox1.text; string filename = system.io.path.getrandomfilename(); string destfile = system.io.path.combine(path.gettemppath(), filename + ".xlsx"); system.io.file.copy(sourcefile, destfile, true); microsoft.office.interop.excel.application xlapp = new microsoft.office.interop.excel.application(); microsoft.office.interop.excel.workbook excelbook = xlapp.workbooks.open(destfile); oledbconnection cnn = new oledbconnection(@"provider=microsoft.ace.oledb.12.0;data source=" + destfile + "; extended properties=excel 12.0;"); string qtext = @"select * [sheet1$]"; oledbcommand oconn = new oledbcommand(qtext, cnn); cnn.open(); oledbdataadapter adp = new oledbdataadapter(oconn); datatable dt = new datatable(); adp.fill(dt); cnn.close(); and start work datatable . in case original source f

How do I get the files back from the .git directory alone? -

is possible source code git .pack files? have full .git folder source entirely missing. possible use these pack files , source code out of master branch? have access .pack files. no repository url! the .git directory full repository, missing work tree inside it's typically located. sits there unaware there's no more enclosing work tree. but things simple: $ mkdir project $ mv /path/to/that/.git project ... ".git" right under "project" ... $ cd project $ git branch ... see list of branches here ... $ git checkout -f master the -f command-line option git checkout crucial if head reference points branch want check out—otherwise git won't try create files in work tree thinking have them checked out consciously deleted.

bluetooth - Samsung Android BLE multiple read/write -

in samsung 4.2 4.3 ble app migration guide ( http://developer.samsung.com/ble ) says: the synchronous nature of stack , f/w hasn’t been affected. is, if call example, writecharacteristic particular characteristic, if returns true, next call bluetoothgatt or bluetoothgattserver method should done after oncharacteristicread callback received. because stack designed support , process 1 gatt call @ time, , if, example, call writecharacteristic or readcharacteristic of characteristic after first one, ignored. is there mistake in paragraph? when need multiple writes why should need read characteristics before/after each write? think should this: .. is, if call example, writecharacteristic particular characteristic, if returns true, next call bluetoothgatt or bluetoothgattserver method should done after oncharacteristicwrite callback received. ... yes of course oncharacteristicwrite callback. copy paste error

Problems with the consolekeys string C# -

i have question code, supposed write i'm typing. consolekeyinfo = console.readkey(); if (a.key == consolekey.spacebar) { console.write(" "); } else if (a.key == consolekey.enter) { console.writeline(""); } else { string b = a.key.tostring(); console.write(b); } if i'm clicking on d example prints: dd but if check b.length equals 1. , if try print b[0] still printing dd . how possible? , how can fix it? the readkey method both reads key , displays user. hence when hit "d" displays "d", returns consolekeyinfo value , code displays "d". results in "dd" display. to stop pass true readkey prevent display consoleinfo = console.readkey(true);

linux - Getting GitHub files (and updates) onto an Ubuntu web server -

i'm setting multi-user, multi-server environment. developers use git , clone various repos github etc. (in 1 account control). now, how files github servers (about 5 of them)? first thinking of sort of automated way push updates guthub servers, i'm thinking might prefer run on command line of each server 'pull' updates github. option doesn't seem done way. can not install git on linux sever (that use serving web files) , use git pull pull them in (i.e. computer used developing)? how people github files web servers? how people github files web servers? generally pushing bare repo on web server, post-receive hook ready checkout repo on site working tree, similar to: git --git-dir=/path/to/bare_repo.git --work-tree=/path/to/website/httpdocs checkout -f you can pull bare repo itself, through cron job instance : */10 * * * * user /home/usern/git-pull-requests/fetch.sh but pull or push mean git installed on server. if don't wan

c# - Cannot create a local site on a IP (default.aspx not getting hit) -

i cannot default.aspx page show on iis. running windows server 2012 box. iis 8. site has default.aspx page in root directory. application. site bound specific ip address. when hit ip not default page. when target page 10.10.10.10/default.aspx following error http error 404.17 - not found requested content appears script , not served static file handler. causes: •the request matched wildcard mime map. request mapped static file handler. if there different pre-conditions, request map different handler. things can try: •if want serve content static file, add explicit mime map. detailed error information: module staticfilemodule notification executerequesthandler handler staticfile error code 0x80070032 requested url http://10.10.10.10/default.aspx physical path c:\inetpub\wwwroot\testsite\default.aspx logon method anonymous logon user anonymous more information: i not sure configured wrong. have recommendations?

c# - strongly-typed resources with custom CultureInfo -

i want both a) explicitly specify cultureinfo @ run-time and b) use strongly-typed resource properties or strongly-typed keys . i mean this: properties.getresourcesforcultureinfo(user.cultureinfo).myresourcefile.mystring; or properties.myresourcefile.resourceset.getstring(myresourcefile.mystringkey, user.cultureinfo); is possible implement?

c - using macros with various trace levels -

i'm setting trace facility in large c application. i'll have multiple levels of tracing info emitted using calls function syslog() emissions. any ideas on how build macro wrap test invoke function based on trace level in effect? trace level integer bitflag. each higher level incorporate each lower levels trace message type. ie: low/med/high...with high set, emit med/low message types well. so macro have bitwise or see if current trace setting in effect incorporate trace directive @ each successive trace statement. ideas?? here idea general scheme: file log.h: #ifndef log_h #define log_h #include <stdio.h> typedef enum { log_level_error, log_level_warn , log_level_info , log_level_debug, } log_level_e; extern log_level_e log_level; #define log(level,...) \ \ { \ if (log_level >= log_level_##level)

sql - How to generate select or insert script of table using SSDT in Visual Studio -

is possible generate select or insert script of 1 table using ssdt in visual studio 2013? i came across entry hoping answer question: how script out data in table? i've used ssms in past generate insert statements load data table. these steps in vs 2013/ssdt 2014: using sql server object explorer pane, right click on table name, choose view data . at top of data pane label max rows combo box, choose all . click on scroll/script icon right of box , produce script of insert statements. the next icon right send statements straight file.

json - Transform PHP into PNG -

i have these scripts: http://pastebin.com/ruhkcafc http://pastebin.com/f3xxdigj as can see in live version here: http://thegelu.com/tfm/helpers.php json data ( http://api.formice.com/helper/online.json ) printed on php-created picture $imagem = new image(502, 500, '#1c3c41'); i'd add own image helpers.png, not helper.php using php gdi functions can create own images text, existing images , more. there lot of documentation online this. since question vague, not partake in typing code. http://www.php.net/manual/en/ref.image.php

python - Why does PySpark get stuck after completing few ShuffleMapTasks? -

i use pyspark run python script, when executing "14/03/23 21:00:30 info scheduler.dagscheduler: completed shufflemaptask(5, 6)" there no reaction, , has been stuck in here, there no error message。 ==========log============= 14/03/23 21:00:30 info scheduler.tasksetmanager: serialized task 5.0:4 3689 bytes in 1 ms 14/03/23 21:00:30 info scheduler.tasksetmanager: starting task 5.0:5 tid 73 on executor 0: myhost-bigdata-110d13 (node_local) 14/03/23 21:00:30 info scheduler.tasksetmanager: serialized task 5.0:5 3689 bytes in 0 ms 14/03/23 21:00:30 info scheduler.tasksetmanager: starting task 5.0:6 tid 74 on executor 2: myhost-bigdata-110d14 (node_local) 14/03/23 21:00:30 info scheduler.tasksetmanager: serialized task 5.0:6 3689 bytes in 0 ms 14/03/23 21:00:30 info scheduler.tasksetmanager: starting task 5.0:7 tid 75 on executor 1: myhost-bigdata-110d12 (node_local) 14/03/23 21:00:30 info scheduler.tasksetmanager: serialized task 5.0:7 3689 bytes in 0 ms 14/03/23 21:00:30 i

ios - How to run a line of code only once for a class -

i creating class ios application deals database functions. have single class method, now, saves data. in it, create database , table. then, begin save data. happens every time method called. however, dealing single database single table, want happen once. #import <sqlite3.h> #import "localdatabase.h" @implementation localdatabase + (void)savedata:(id)sender { /* create database (if doesnt exist) */ sqlite3 *database = nil; nsstring *path = [[nssearchpathfordirectoriesindomains(nsdocumentdirectory, nsuserdomainmask, yes) firstobject] stringbyappendingpathcomponent:@"db.sql"]; if(sqlite3_open([path utf8string], &database) != sqlite_ok) { nslog(@"failed open database"); } /* create table (if doesnt exist) */ char *err; nsstring *statement = @"create table if not exists data (id integer primary key autoincrement, name text, category text)"; if (sqlite3_exec(database, statement, null, nul

javascript - Node.js / Socket.io raising Error at TCP.Onread -

i'm running simple node instance pushes data redis clients through socket.io. my node server crashes time time. , i've spend hours in debugging, can't find problem. it not predictable. instance runs fine 36 hours, sometime crashes every minute. i receive following error message: events.js:77 throw er; // unhandled 'error' event ^ error: read econnreset @ exports._errnoexception (util.js:676:11) @ tcp.onread (net.js:529:26) this code: var http = require('http'); var server = http.createserver().listen(4000); var io = require('socket.io').listen(server); var redis = require('socket.io/node_modules/redis'); var sub = redis.createclient(); var sc = redis.createclient(); //active socket counter //subscribe redis chat channel sub.subscribe('chat'); sub.subscribe('total_spots'); io.sockets.on('connection', function (socket) { //grab message redis , send client sub.on('mes

Facebook Javascript SDK error "Object [object Object] has no method 'init` -

one of first things needs done in order load sdk interacting facebook, run: fb.init(params) this method used initialize , setup sdk. . . . . . other sdk methods must called after one, because won't exist until do. facebook javascript sdk: .init() i'm getting error msg: object [object object] has no method "init" i'm not getting error fb undefined, i'm assuming @ least part of facebook javascript sdk loaded. when sdk loads, facebook puts contents <div> element: <div id="fb-root"></div> just fun of it, used .innerhtml see if extract out of <div> . var fbrootcontent = document.getelementbyid('fb-root').innerhtml; console.log("fbroot content: " + fbrootcontent); and show got injected <div> . so, . . . i'm assuming @ least of facebook javascript sdk loaded. one possible issue, i'm using google apps script, , lots of content gets sanitized , stripped out befor

c - Whats the correct value to base the maximum number of CPU's to sched_setaffinity to? -

i have confusion whats correct value use number of cpu's can use make cpu_set sched_setaffinity call on system. my /proc/cpuinfo file: processor : 0 vendor_id : genuineintel cpu family : 6 model : 37 model name : intel(r) core(tm) i5 cpu m 460 @ 2.53ghz stepping : 5 microcode : 0x2 cpu mhz : 1199.000 cache size : 3072 kb physical id : 0 siblings : 4 core id : 0 cpu cores : 2 apicid : 0 initial apicid : 0 fdiv_bug : no f00f_bug : no coma_bug : no fpu : yes fpu_exception : yes cpuid level : 11 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe nx rdtscp lm constant_tsc arch_perfmon pebs bts xtopology nonstop_tsc aperfmperf pni dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm pcid sse4_1 sse4_2 popcnt lahf_lm ida arat dtherm tpr_shadow vnmi flexpriority ept vpid bogomips : 5056.34 clflush size : 64 cache_alig