Posts

Showing posts from 2013

How to display latitude and longitude for every five seconds using alarm manager in android? -

i creating application in have show reminder every 5 minutes. instead of reminder have show longitude , latitude every 5 minutes. have 2 activities: 1 alarmmanager , other alarmmanagerbroadcastreceiver . how do this? public class alarmmanagerbroadcastreceiver extends broadcastreceiver { string gps; final public static string one_time = "onetime"; @override public void onreceive(context context, intent intent) { powermanager pm = (powermanager) context.getsystemservice(context.power_service); powermanager.wakelock wl = pm.newwakelock(powermanager.partial_wake_lock, "your tag"); wl.acquire(); bundle extras = intent.getextras(); stringbuilder msgstr = new stringbuilder(); if(extras != null && extras.getboolean(one_time, boolean.false)){ msgstr.append("reminder"); } format formatter = new simpledateformat("hh:mm:ss a"); msgstr.append(formatter.format(new date())); ...

javascript - polling vs long polling -

i got onto these examples showing polling vs long-polling in javascript, not understand how differ 1 another. regarding long polling example, how keep connection open? this traditional polling scenario looks like: (function poll(){ settimeout(function(){ $.ajax({ url: "server", success: function(data){ //update dashboard gauge salesgauge.setvalue(data.value); //setup next poll recursively poll(); }, datatype: "json"}); }, 30000); })(); and long polling example: (function poll(){ $.ajax({ url: "server", success: function(data){ //update dashboard gauge salesgauge.setvalue(data.value); }, datatype: "json", complete: poll, timeout: 30000 }); })(); thanks! the difference this: long polling allows kind of event-driven notifying, server able actively send data client. normal polling periodical checking data fetch, say. wikipedia quite detailed that: with long polling, client re...

asp.net mvc - Dynamically Managing MVC Layouts -

i have small mvc web project want able achieve following: select base page layout , css/javascript based upon active domain optionally allow base/default setting overridden @ start of session. to achieve have created layout object following properties: public class pagelayout { public string reference { get; set; } public string domain { get; set; } public string layoutpath { get; set; } public string csspath { get; set; } public string javascriptpath { get; set; } } my idea being @ start of session, url checked layout parameter. example: http://www.{domain}.com/tech in instance, pagelayout object reference "tech" retrieved. if no parameter found page layout object domain property matching active domain retrieved. i have several questions regarding right way implement this: where best place implement logic in mvc? session_start method in global.asax seems potential candidate i want persist retrieved pagelayout object across whole sess...

database - How to synchronize tables in Django? -

in database want synchronize 2 tables. use auth_user(default table provided django) table registration , there table user-profile contain entities username, email, age etc. how autometically upadate columns username , email in user-profile according updation in auth_user table. from django.contrib.auth.models import user class profile(models.model): username = models.charfield(max_length = 30) email = models.emailfield() age = models.positiveintegerfield() auth_user_id = models.foreignkey(user) you can either modify django registration code , include code save profile model on every new registration. or you can set signal on every save of user model. see documentation . def create_profile(sender, **kwargs): if kwargs["created"]: p = profile(user=kwargs["instance"], ...) p.save() django.db.models.signals.post_save.connect(create_profile, sender=user) create_profile() called every time user object saved. in...

php - Can i insert into two different tables from the same statement? -

i have car application, cars have bunch of information avaible count kept essential on table called auto , made huge table attributes cool. wish can insert same array data 2 different tables under same pdo $sql = "insert auto(year, make, model, mileage, price, vin, att1, att2, att3, att4, picture1, picture2, picture3, picture4, picture5, picture6, picture7, picture8, picture9, picture10, picture11, picture12) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"; can 'and insert attributes (' $sth = $dbh->prepare($sql); $final = array_merge(array_values($vehicleinfo),array_values($paths)); $sth->execute($final); echo '<h4 id="successmessage" style="color: red;">vehicle added succesfully</h4>'; i'd tempted loop on tables want run sql on; $tables = array('auto', 'attributes'); foreach($tables $table) { $sql = 'inse...

subnet - Obtaining SubnetMask in C -

i wanted ip address , subnet mask. ip part done, couldn't find socket function return structure subnet mask in it. socket function exist, returns in structure? thanks! in windows using iphelper. #include <winsock2.h> #include <iphlpapi.h> #include <stdio.h> #include <stdlib.h> #pragma comment(lib, "iphlpapi.lib") #define malloc(x) heapalloc(getprocessheap(), 0, (x)) #define free(x) heapfree(getprocessheap(), 0, (x)) /* note: use malloc() , free() */ int __cdecl main() { pip_adapter_info padapterinfo; ulong uloutbuflen = sizeof (ip_adapter_info); padapterinfo = (ip_adapter_info *) malloc(sizeof (ip_adapter_info)); getadaptersinfo(padapterinfo, &uloutbuflen); printf("\tip mask: \t%s\n", padapterinfo->ipaddresslist.ipmask.string); } if (padapterinfo) free(padapterinfo); return 0; }

c# - Implementing wcf with mvc4 entity framework fails invoking method -

i have wcf application in have used entitity framework , have implemented dbcontext querying database. when view svc file in browser exposes operations. i have interface class this: [servicecontract] public interface iservice1 { [operationcontract] list<booksmodels> getbookslist(); [operationcontract] booksmodels getbook(int id); } i have implementation in svc.cs file public list<booksmodels> getbookslist() { mvcentity en = new mvcentity(); return en.book.tolist(); } public int getbookid(int id) { //return db.book.find(id); return 1; } and booksmodels class this [datacontract] public class booksmodels { [key] [datamember] public int bookid { get; set; } [datamember] public string bookname{get;set;} } and have config file default 1 created when creating wcf service application . but ...

tapandhold - Move text and images on press and hold windows phone 8 -

my windows phone 8 application requires move image and/or text desired positions if needed user pressing , holding tht text or image. text , image prepopulated fixed positions. if user wants rearrange positions can hold gesture on required text or image. possible?. , if yes code snippets or links available on same?. yes! possible. see drag , drop in windows phone here you need integrate gesture hold event. hope helps.

MathJax how to know whether all operations in queue have been executed completely? -

i have perform action after processes pushed in queue have been executed completely. have function creating div element.this function queued using mathjax queue.suppose wrap element created in function.now returning wrap.innerhtml outside function.what happening here control reaching return wrap.innerhtml statement before process queued creation of element complete. you not able return wrap.innerhtml function performs queue.push() , since wrap isn't created until queued function runs, , may not until later. whatever needs use wrap.innerhtml have run callback instead. call function has been pushed() , or push() callback onto queue runs after function finished.

android - ActionButton minWidht ignored in some devices -

i'm using actionbarsherlock in project, i'm displaying 3 action buttons custom minwidth. here code: menu.xml <?xml version="1.0" encoding="utf-8"?> <menu xmlns:android="http://schemas.android.com/apk/res/android"> <item android:id="@+id/menu_item1" android:showasaction="always" android:title="@string/empty" android:icon="@drawable/item1_selector" /> <item android:id="@+id/menu_item2" android:showasaction="always" android:title="@string/empty" android:icon="@drawable/item2_selector" /> <item android:id="@+id/menu_item3" android:showasaction="always" android:title="@string/empty" android:icon="@drawable/item3_selector" /> </menu> and styles values/styles.xml <resources xmlns:android="http://schemas.android.com/apk/res/android...

php - How to create different button based on a condition? -

how create button based on status. let's if i'm not logged in login, button direct login page, if not, button direct logout page. can tell me how in php ? attempt: $loginstatus = false; session_start(); if(isset($_session['loginname'])){ $loginstatus = true; } else { $loginname = "guest"; } something this? <?php $loginstatus = false; session_start(); if(isset($_session['loginname'])) { ?> <a class="button" href="logout/path">logout</a> <?php } else { ?> <a class="button" href="login/path">logout</a> <?php } ?> in case use <a> tag, if want use regular button can javascript or form.

objective c - iOS: Internalization the Japanese date format to show Heisei Calendar -

i developing ios application support english , japanese language. i want show date's japanese calendar type(heisei). instead of showing english year 2013, want show heisei year 25. january 5, 25 heisei (region format: u.s., calendar: japanese, language: english) 平成25年1月5日 (region format: japan, calendar: japanese, language: english) note: unable see heisei in ios calendar when change calendar type japanese. use date formatters , locales. if want "january 5, 25 heisei" format, that's locale identifier of en_us@calendar=japanese . identifier "平成25年1月5日" ja_jp@calendar=japanese . this code illustrates use of both convert "january 5, 25 heisei" string nsdate , , convert nsdate string in form of "平成25年1月5日". nsdateformatter *formatter = [[nsdateformatter alloc] init]; formatter.locale = [[nslocale alloc] initwithlocaleidentifier:@"en_us@calendar=japanese"]; formatter.datestyle = nsdateformatterlongstyle; ns...

git: Make the work tree reflect only a subpath of the whole tree -

i checkout whole branch, work inside specific directory of branch. therefore sort of "dive in" whole tree , make work tree reflect subdirectory chose. e.g.: "master" tree dir1/ file1 file2 dir2/ file3 work-dir tree .git file1 file2 my guess this: git checkout master:dir1/ however, doesn't work , reports error: fatal: cannot switch branch non-commit 'master:dir1/' is possible? note: don't want use submodules because don't want slice repo unrelated pieces. subtree merge, far can tell, helps me synchronize 2 separate directories similar structures different histories. want modify original objects in repo , able merge them , forth , retain history. it's not possible. can use cd dir1 , git still work there, allowing use git add file1 instead of git add dir1/file1 etc.

marshalling - Is this C# struct guaranteed to have the desired size? -

i create type safe pointer structure wrapping intptr : struct pointer<t> { private intptr ptr; // methods marshalling , t } but want able marshal pointer<t> instances if intptr s, need have same size , layout. guaranteed? if not, if add [structlayout(layoutkind.sequential, pack = 1)] at top? basically, @ end should able marshal c struct struct foo { int *data; }; using c# struct: struct foo { public pointer<int> data; } it fine as-is, no need help. a struct type in c# automatically gets [structlayout] attribute. default sequential packing of 8. same kind of packing used default in unmanaged code. doesn't matter anyway when have 1 field in struct. just make sure don't add fields , don't use automatic properties. can double-check marshal.sizeof(), should 4 in 32-bit mode , 8 in 64-bit mode. or in other words, equal intptr.size

Android WebView post + custom headers -

my initial webview request looks this: webview.posturl(url, postdata); i need able set content-type header request. content-type = application/json how can api 8? tried shouldoverrideurlloading never gets called. heard works get, have use post.

How to create custom layouts in websphere portal 8 -

please tell exact procedure create custom layout in websphere portal 8 such can used newly created pages. can't understand online content doing so. thanks in advance. have checked out documentation ? you can copy 1 of layout-templates , start working there.

asp.net - An object reference is required for the non-static field, method, or property '_Default.RadioButtonList2' -

i have gridview bind data database using stored procedure. below part of code behind error above: [webmethod] public static string getlist(int pageindex){ .... ..... cmd.parameters.addwithvalue("@customergroup", radiobuttonlist2.selectedvalue); //error here .... .... } i have code gridview: <asp:radiobuttonlist id="radiobuttonlist2" runat="server" autopostback="true" font-size="1em" enableviewstate="true"> <asp:listitem value="1">africa</asp:listitem> <asp:listitem value="2" >america</asp:listitem> <asp:listitem value="3">europe</asp:listitem> <asp:listitem value="4">asia/asp:listitem> <asp:listitem value="5">australia</asp:listitem> </asp:radiobuttonlist> ...

vb.net - Generic Method for Numeric Types -

in vb.net if want have extension method numerical variables of different types ( integer , long , decimal , double ) have define multiple methods these: <extension()> public function add(a integer, b integer) integer return + b end function <extension()> public function add(a long, b long) long return + b end function <extension()> public function add(a double, b double) double return + b end function <extension()> public function add(a decimal, b decimal) decimal return + b end function now 1 single operation alright, more methods want create more duplicates have to, too. is there generic way so? love see (pseudo-code): <extension()> _ public function add(of t numeric)(a t, b t) t return + b end function or there other concept doing so? this cannot done, because cannot constrain generic type group of numeric types ( integer , long , decimal , double ). problem there no iarithmetic interface use constrain t t...

c# - save only edited listbox entries -

if i've existing entries in listbox. when click on edit button i'll able edit entries. after editing 1 or more entries when again clicked on button, want save entries edited. how this? please suggest solution. couple of ways of doing that. can save each entry list<t> on every edit, or can cache (pre-store) listbox items , after finishing editing can compare latest previous , extract out edited items. imo first approach better , easier implement.

javascript - Style of cursor is not changing -

i have code put wait cursor on images when image clicked. function disablebutton() { idstopselbtn.style.cursor='wait'; idstartselbtn.style.cursor='wait'; idbouncerunningbtn.style.cursor='wait'; idstopallbtn.style.cursor='wait'; idstartallbtn.style.cursor='wait'; idbounceselbtn.style.cursor='wait' } when function called clicking of button gets designed function take away wait cursor , put default cursor. function enablebutton(strtype) { idstopselbtn.style.cursor='default'; idstartselbtn.style.cursor='default'; idbouncerunningbtn.style.cursor='default'; idstopallbtn.style.cursor='default'; idstartallbtn.style.cursor='default'; idbounceselbtn.style.cursor='default'; alert('done'); } the wait sign still not going after calling function.i added alert check if function firing or not , it's firing, still cursor sign not changing. try setting auto instead of ...

apache2 - apache and php response after databse commit -

i have application send ajax request apache server. php process data , save in database, send response web client. sometimes, due slow networks, ajax client don't receive response, ajax timeout. data save in database , ajax client try resend data generating duplicate entries in database. there way of apache detect response not received , return php proccess rollback in database? or have implement manually?

How to convert HTML file into a hash in Perl? -

is there simple way convert html file perl hash? example working perl modules or something? i search on cpan.org did'nt find can want. wanna this: use example::module; $hashref = example::module->new('/path/to/mydoc.html'); after want refer second div element this: my $second_div = $hashref->{'body'}->{'div'}[1]; # or this: $second_div = $hashref->{'body'}->{'div'}->findbyclass('.myclassname'); # or this: $second_div = $hashref->{'body'}->{'div'}->findbyid('#myid'); is there working solution this? html::treebuilder::xpath gives lot more power simple hash would. from synopsis: use html::treebuilder::xpath; $tree = html::treebuilder::xpath->new; $tree->parse_file( "mypage.html"); $nb=$tree->findvalue('/html/body//p[@class="section_title"]/span[@class="nb"]'); $id=$tree->findvalue('/html/body/...

java - Migrated to logback on weblogic, but is not logging -

i running poc see impact of migrating our j2ee applications logback. spent time on official website , apparently, change beside new jars logback.xml file. unfortunatly doesn't enough, deployment works , log file created well, nothing logged (empty). my code has following statements import org.slf4j.logger; import org.slf4j.loggerfactory; private static final logger log = loggerfactory.getlogger(customerservicebean.class); log.debug("test log - customer id " + input.getcustomerid()); pom.xml has following <dependency> <groupid>ch.qos.logback</groupid> <artifactid>logback-classic</artifactid> <version>0.9.18</version> </dependency> logback.xml (created using web utility official website) <configuration> <appender name="file" class="ch.qos.logback.core.rolling.rollingfileappender"> <!--see http://logback.qos.ch/manual/appenders.html#rollingfileappender--> ...

c# - Three layers of culture specific resource files -

i need way use third "layer" of culture specific resource file. can possibly done in way should be, , possibly hacked somehow. , long hack isn't big, it's okay! solution possible (if i'm approaching problem wrong, please tell better solution). normally have default resource file, works fallback. on top of can have culture specific resource language. want 'theme' specific resource. the thing have several sites different themes (horses, cars, rc-units, etc.), , when use string localized resource file if resource isn't translated in specific language yet, it'll fallback english default language. cool! a problem example: have phrase "add horse" , "add car" , might seem same (when comes grammar) in english, yet that's not case in polish or romanian! so i'm thinking should, if possible, having english file "add {0}", polish file equivalent sentence in polish, on top of "car" specific polish tra...

powershell - How to use the index property of the DfsrIdRecordInfo WMI class for pagination of WMI queries -

edit: should have posted on serverfault instead? there not dfs-r category on stackoverflow, thought more of scripting\programming question. let me know if should put on serverfault instead. i attempted use dfsridrecordinfo class retrieve files of large (6000 file) dfsr database , getting wmi quota errors. doubling , tripling wmi quotas on server did not solve this. i found looking here index property of class is: "the run-time index of record. value used partition result of large query." sounded wanted, behavior of property not expected. i found when try paging property not retrieve of records per following example powershell. i tested on dfsr database less 700 files not throw quota error. because small database can files in less second: $dfsrfiles = gwmi ` -namespace root\microsoftdfs ` -computername 'dfsrserver' ` -query "select * dfsridrecordinfo replicatedfolderguid = '$guid'...

python - Getting an invalid syntax error -

apologies in advance know simple problem. i'm total beginner python, have decided use write mapreduce doing sentiment analysis. i have taken python file link: http://www.alex-hanna.com/tworkshops/lesson-6-basic-sentiment-analysis/ give me guidance , trying run it. code particular thing have problems is: … if len(sys.argv) &lt; 2: print "usage: avgnreduce.py " sys.exit(0) … the error is: if len(sys.argv) &lt; 2: ^ syntaxerror: invalid syntax i'm assuming basic problem resolve, despite googling don't know how i'm meant fix this. i've tried using colon instead of semi colon , have ensured ampersand correct copying over. ideas? you're looking < operator there instead of lt . ( lt stands less operator in html, see this thread.) if len(sys.argv) < 2: print "usage: avgnreduce.py " sys.exit(0)

Not able to consume Web Service method when using asp.net forms authentication -

one of asp.net page using web service object data database, working fine locally hosted server if not using forms authentication , when use forms authentication method same page, getting following run-time error, error :the request failed error message: -- <html><head><title>object moved</title></head><body> <h2>object moved <a href="%2flogon.aspx%3freturnurl%3d%252fchocolates.asmx">here</a>.</h2> </body></html> i'm using <sessionstate mode="inproc" cookieless="false" timeout="30" /> in web.config, please me answer problem. thank you. did try exclude "chocolates.asmx" forms authentication? example: <location path="path_to_the_file_or_folder"> <system.web> <authorization> <allow users="*"/> </authorization> </system.web> </location>

jquery - Flash error from an ajax request in compoundjs -

i trying use flash('error', 'error text') alert webpage error has occurred via ajax request. ajax request hits action database work involved, , error produced. controller: load('application'); action('index', function() { this.title = 'sample page'; render(); }); action('test', function() { flash('error', 'test error message'); render('index', { title: 'sample page' }); }); sample ajax call: $.ajax({ url: '/test-error', success: function(response) { console.log(response); }, error: function(response) { console.log(response); } }); routes: map.get('test', 'test-error#index'); map.get('test-error', 'test-error#test'); is possible through ajax call? i've tried using flash , followed render('index') shown above , have tried redirect(path_to.test); no success. send(500, 'error messag...

function - Invoke-Command powershell trouble -

friend's i've got trouble function, run on remote server, i've got following output : invoke-command : positional parameter cannot found accepts argument '& c:\testnunit\dll\'. @ d:\test\multithread.ps1:65 char:16 + invoke-command <<<< -computername $serv -scriptblock $command ([scriptblock]::create("& $oneproject")) -credential $cred + categoryinfo : invalidargument: (:) [invoke-command], parameterbindingexception + fullyqualifiederrorid : positionalparameternotfound,microsoft.powershell.commands.invokecommandcommand function nunit { ##parse connection parameters $connection = @{"server" = "..."; "username" = "..."; "password" = "...."} $serv = $connection.get_item("server") $user = $connection.get_item("username") $pass = $connection.get_item("password") $securepassword = convertto-securestring -asplaintex...

nvd3.js - How can I manipulate nvd3 Horizontal Multi-Bar Chart values -

i using nvd3.js , multibarhorizontal http://nvd3.org/ghpages/multibarhorizontal.html want change bars' reference on x-axis value , instance value of 10 should represented 10 out of 50. value ---------- x-axis -------------------------------------------------- don't know start from. if understood question looking @ suppose - chart.xaxis.tickformat(function(d) { return d + '/50' }); hope helps.

jquery - Web API controller named Aux -

this might sound silly tried create controller (web api - mvc 4) public class auxcontroller : apicontroller { [httpget] public user getuser() { ... } } when called api via jquery var options = { url: 'api/aux/getuser', type: 'get', datatype: 'json' }; i error. if refactor controller public class audcontroller : apicontroller and use url option: 'api/aud/getuser' it works nicely. and guessed it, if refactor back, doesn't work. is there reason why happens? machine? certain keywords such aux not allowed in url. believe this answer question.

text - Is there a Trigram functionality like pg_trgm (PostgreSQL) for MySQL? -

i created fuzzy search in c# postgresql database using similarity() function pg_trgm module. want port search mysql database, mysql has no similar trigram functionality. is there way import pg-trgm module postgresql in mysql or there similar implementation of trigrams mysql? unfortunately not able find satisfying implementation yet. i reluctant use external search engine solr due effort of installation, maintenance , becoming acquainted syntax , configuration. i know question old, got here google searching , there bit of new information found. as of mysql 5.7.6, there built in support using ngram in full text searches. mysql team article regarding ngram searches

php - Adding frineds with the use of emails stored in the database -

i have been working on add friend system quiet sometime now, when got 1 won't work , don't know why please appreciated <?php session_start(); include('config.php'); if(isset($_post['submit'])){ $user_id = $_get['user_id']; $email = isset($_post['added_id']); $connect = mysql_connect('localhost', 'root', '') or die('error searching host'); $db = mysql_select_db('9jahivemobile') or die('could not find database'); $query = "select * admin email = '".$email."'"; $numrows = mysql_num_rows($query); if ($numrows ==1){ echo 'found!'; $insert = 'insert connected ("adder_id", "added_id") values ("'.$user_id.'" "'.$email.'")'; echo'hooray request have been sent'; ...

Java Collection: what to convert Collection<List<String>> to ArrayList<List<String>> or List<List<String>>? -

i using multimap<string, list<string>> in 1 of api's. values means list of list used .values() method of multimap. method returning me collection<list<string>> . play on index on collection want convert list<list<string>> or arraylist<list<string>> . how cast or convert without building new arraylist , explicit add list values collections arraylist. you can use appropriate constructor: list<list<string>> yourlist = new arraylist<>(yourcollection); the order of elements in list order of iterator of collection.

python - Extract java script from html document using regular expression -

i trying extract java script google.com using regular expression. program import urllib import re gdoc = urllib.urlopen('http://google.com').read() scriptlis = re.findall(r'<script>(.*?)</script>', gdoc) print scriptlis output: [''] can 1 tell me how extract java script html doc using regular expression only. this works: import urllib import re gdoc = urllib.urlopen('http://google.com').read() scriptlis = re.findall('(?si)<script>(.*?)</script>', gdoc) print scriptlis the key here (?si) . "s" sets "dotall" flag (same re.dotall ), makes regex match on newlines. root of problem. scripts on google.com span multiple lines, regex can't match them unless tell include newlines in (.*?) . the "i" sets "ignorcase" flag (same re.ignorecase ), allows match can javascript. now, isn't entirely necessary because google codes pretty well. but, if had poor ...

session - redirect back to previous page php -

i trying redirect user page he/she after successful login not working right me. the problem instead of redirecting previous page redirects account.php.. edit : have session started on page , including file. the main page... index.php <?php include_once("models/config.php"); $_session['page'] = 'index.php'; ?> and here login php.. if(isset($_session["page"]) && is_object($_session["page"])) //check if session exists { //redirect user previous page header("location:".$_session['page']); } else{header("location:account.php");die();} you need add exit or else continue process rest of script. if(!empty($_session["page"])) //check if session exists { //redirect user previous page header("location:".$_session['page']); exit; } else{header("location:account.php");exit;} as christopher morrissey ...

php - Facebook autopost link opens as map on phone -

i cannot find hint of issue anywhere on google. have android , other developer has iphone. use facebook autopost php script autopost links facebook feeds. when open feed via mobile phones opens map first , have click back. happens on phone random things thought phone issue. not happening other posts click on, ours. when create facebook app there setting enables/disables locations or maps may causing issue? the solution particular problem simple. link correct on facebook. page opened on our website had google map in page footer. once removed page, default map application stopped opening first. double check page content!

node.js - Serving socket.io via https -

i got code: var io = require('socket.io').listen(443); var redis = require('redis'); thinking can load socket.io client via https://<my ip>/socket.io/socket.io.js but error ssl connection error it works fine http , port 80. need working serving https? update: i have managed update code, here share community:i socket.io.js served client cant subscription redis channels working quite yet. so here latest code: var https = require('https'); var fs = require('fs'); var socketio = require('socket.io'); var redis = require('redis'); var nclients=0; var nport = 6800; // port of redis server var nhost = "123.123.123.123"; // host running redis server var spass = "mysecretpassword"; var svrport = 443; // port of service var svroptions = { key: fs.readfilesync('/etc/ssl/private/my.key'), cert: fs.readfilesync('/etc/ssl/private/my.crt'), ca: fs.read...

java - Delete fails due to DB exception in updateForeignKeyFieldBeforeDelete -

i using eclipselink , facing issues in delete. have manytoone join below. public class userentity implements serializable { ... @manytoone @joincolumn(name = "student_cd", nullable=false) private studententity student; } while trying delete userentity , getting below exception. [#|2013-08-07t20:44:52.105+0530|warning|glassfish3.1.2|javax.enterprise.resource.jta.com.sun.enterprise.transaction|_threadid=35;_threadname=thread-2;|dtx5014: caught exception in beforecompletion() callback: local exception stack: exception [eclipselink-4002] (eclipse persistence services - 2.3.2.v20111125-r10461): org.eclipse.persistence.exceptions.databaseexception internal exception: java.sql.sqlexception: ora-01407: cannot update ("service"."users"."student_cd") null error code: 1407 call: update service.users set student_cd = ? (user_id = ?) bind => [null, 1] @ org.eclipse.persistence.exceptions.databaseexception.sqlexception(databaseexceptio...

excel - Hide subtotals for one of the values in Pivot Table -

the issue in pivot table on excel 2007. in column have year field, , values sum of amount, , max of date. max of date value doesn't need subtotals of grand totals. there way omit totals on on of value fields, , not other? eg: 2013 2014 date amt date amt grand totals amt comp1 1/1/01 12 1/2/01 10 22 comp2 1/3/02 15 1/3/02 5 20 totals 27 15 a hack: hide date total column , format date grand totals row same colour font highlighting.

vba - Output/Print variable, in code, in if statement -

i trying achieve following: user shown excel spread sheet list of assumption can change. title | value | input01 | 10 | = input02 | 2 | >= input03 | 800 | >= input04 | 4 | >= input05 | 2 | <= there if .. then statement pulls in data if assumption met. if assumption blanc, should not included in if .. then statement. if x = input01value , y >= input02value _ , z >= input03value , >= input04value _ , b <= input05value user ommits input03 if x = input01value , y >= input02value _ , >= input04value , b <= input05value now check see if each value exist, , follow if statement appropriate variables. seems bit redundant. i wondering if following possible: input 01 = "" if input01value != "" input01 = "x = " & input01value 'then use join or similar join of them .. and use input01 direct...

Selenium IDE with XPath to identify cell in table based on other column -

please take @ snippet of html below: <tr class="clickable"> <td id="7b8ee8f9-b66f-4fba-83c1-4cf2827130b5" class="clickable"> <a class="editlink" href="#">single</a> </td> <td class="clickable">£14.00</td> </tr> i'm trying assert value of td[2] when td[1] contains "single". i've tried assorted variants of: //td[2][(contains(text(),'£14.00'))]/../td[1][(contains(text(),'single'))] i've used similar notation elsewhere - no avail here... think it's down td[1] having nested element, not sure. can enlighten i'm getting wrong? :) cheers! what about: //tr[contains(td[1], "single")]/td[2] first select <tr> containing <td> matching text, , select td[2] . then, contains(//tr[contains(td[1], "single")]/td[2], "£14.00") should return true . or, closer expression trie...

android - UI Layout Issues -

first let me attempt layout trying accomplish here. edittext edittext searchbutton listview (search result. there can one, listview adapter , height of wrap_content seems work this, there button add result listview below. once add button clicked listview collapses, after) textview (label objects added) listview (list of objects added, again i'm using adapter list row layout) savebutton i going paste code have there go through. issues having listviews. basically, listview contains objects added end pushing savebutton off of screen. have tried ton of solutions laid out on , many other sites don't seem work right. basically, want savebutton @ bottom , don't want pushed off screen when listview gets big. solution have found "work" explicitly set height of listviews. however, causes problems when going tablet phone (nexus7 & galaxy s3). thought using dip sizes prevent happening apparently not. if has strategy creating type of layout great. ...

c# - If I have multiple users on my site at the same time, how do I keep their sessions separate? -

i have created web application , upload on iis(6.1), i'm facing issue, since uploaded onto iis. in application authentication of user done through ad (active directory) group. when user "a" logs application works fine , home page shows welcome message "welcome user : a", problem occurs when user "b" logs application. when user "b" logs in, , user "a" refreshes page, home page of user "a" shows welcome message "welcome user : b". note both users on physical different machines. can me in issue? here code : when login page loads, following code executes : protected void page_load(object sender, eventargs e) { _txtpassword.focus(); lb_errormsg.visible = false; try { if (!page.ispostback) { loghelper.logger.info("load login page."); loghelper.logger.info("get employee id , domain variables...

jquery - Hide a class if the text in another class contains . . . -

i working form has multiple steps, hide span of text has class .newtest applied if class, .regcurrent contains text "step 1 selection". <ol class="steps"> <li class="regcurrent">step 1 selection</li> <li class="notcurrent">step 2 selection</li> <li class="notcurrent">step 3 selection</li> </ol> <div class="singlecol"> <span class="newtest"> <h1>some text</h1> <p>some more text</p> </span> <p>some text , tables</p> </div> what have tried: <script> $(document).ready(function() { if( $('.regcurrent:contains("step 1 selection")') { $('.newtest').hide(); } }); </script> you have use length selector in condition, other wise wont false jquery object event when selector not return object. missed closing parenthesis of in condition. live demo $(document).rea...

osx - Fork loop installing Ruby 1.9.3 using RVM on OS X 10.7 -

when trying use rvm install ruby 1.9.3 on os 10.7 mbp, infinite loop tries find ruby install: $ rvm system $ rvm install 1.9.3 searching binary rubies, might take time. no binary rubies available for: osx/10.7/x86_64/ruby-1.9.3-p448. continuing compilation. please read 'rvm mount' more information on binary rubies. warning! requested ruby installation requires ruby available - installing 1 first. searching binary rubies, might take time. no binary rubies available for: osx/10.7/x86_64/ruby-2.0.0-p247. continuing compilation. please read 'rvm mount' more information on binary rubies. warning! requested ruby installation requires ruby available - installing 1 first. searching binary rubies, might take time. no binary rubies available for: osx/10.7/x86_64/ruby-2.0.0-p247. continuing compilation. please read 'rvm mount' more information on binary rubies. warning! requested ruby installation requires ruby available - installing 1 first. searching binary r...

c# - What algorithm can I use to recursively load an entire directory, starting from a specified path? -

i'm building custom file dialog, , problem taking long load. the dialog begins initialdirectory property, , looking find way load directory tree initialdirectory first, followed rest of directories in background thread. for example, if initialdirectory c:\users\user12345\mydocuments , should load folders in c:\ c:\users c:\user12345 c:\users\user12345\mydocuments then kick off background thread load remaining directories. is there fast , easy way use recursion load first initialdirectory , else, without duplicating items? i'm struggling find high-performing way this, since checking existance of folder code if (!directory.contains(f => f.fullname == folder.fullname)) slows down load quite bit. my current code load full directory looks this: private void loaddirectory() { string root = @"c:\"; var rootnode = new directorymodel() { name = root, fullname = root }; this.directory.add(rootnode); directoryinfo info = new directory...

c - Including a header with code::blocks -

so, i've created c project in code::blocks. in beginning contains main.c file. i've added c++ class (gobject c) dividing project src , include folders, changed extension in cpp file c. when try compile gives me message: fatal error: /home/user/project_name/src/a.h: no such file or directory so, class name a: path header : include/a.h path definition : src/a.c code a.c (i've tried include "/include/a.h" , include "include/a.h" without result) #include "a.h" code a.h #ifndef a_h #define a_h #endif how can solve problem? i've tried include a.h in main.c (without result :( ) when include file in c, c preprocessor default can search in 2 places: 1) #include <stdlib.h> - stdlib.h searched in compiler's include search path 2) #include "mylib.h" - mylib.h searched in current directory (unless traverse directories) you should try doing #include "../include/a.h" inside of src...

functional programming - Why doesn't outer work the way I think it should (in R)? -

prompted @hadley's article on functionals referenced in answer today , decided revisit persistent puzzle how outer function works (or doesn't). why fail: outer(0:5, 0:6, sum) # while outer(0:5, 0:6, "+") succeeds this shows how think outer should handle function sum : outer <- function(x,y,fun) { mat <- matrix(na, length(x), length(y)) (i in seq_along(x)) { (j in seq_along(y)) {mat[i,j] <- fun(x[i],y[j])} } mat} > outer(0:5, 0:6, `+`) [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 0 1 2 3 4 5 6 [2,] 1 2 3 4 5 6 7 [3,] 2 3 4 5 6 7 8 [4,] 3 4 5 6 7 8 9 [5,] 4 5 6 7 8 9 10 [6,] 5 6 7 8 9 10 11 ok, don't have indices aligned example, wouldn't hard fix. question why function sum should able accept 2 arguments , return (atomic) value suitable matrix element, cannot when passed base::outer functi...

iphone - Keep UIScrollView in correct place after switching from landscape to portrait -

i have uiscrollview contains text field , text view. have code move text fields when keyboard present keyboard not cover text fields. code works great in portrait view: -(bool)textfieldshouldreturn:(uitextfield *)textfield { if(textfield) { [textfield resignfirstresponder]; } return no; } -(void)textfielddidbeginediting:(uitextfield *)textfield { if (textfield == self.namefield) { [uiview beginanimations:nil context:null]; [uiview setanimationdelegate:self]; [uiview setanimationduration:0.3]; [uiview setanimationbeginsfromcurrentstate:yes]; self.view.frame = cgrectmake(self.view.frame.origin.x, (self.view.frame.origin.y - 90), self.view.frame.size.width, self.view.frame.size.height); [uiview commitanimations]; } } -(void)textfielddidendediting:(uitextfield *)textfield { if (textfield == self.namefield) { [uiview beginanimations:nil context:null]; [uiview setanimationdelegate:self];...

knockout.js - Knockoutjs Options Binding with JSON data? -

i trying list options select tag server of knockout options binding. have php page returns json data pushed knockout observable array binded select tag. somehow not working, please refer following code reference: html: <div class="form-group"> <select class="form-control"> <option data-bind="options: country_names, optionstext: 'country_name'"></option> </select> </div> javascript: $(document).ready(function(){ function appmodel(session_info){ /* session info related bindings commented working fine */ var self = this; this.country_names = ko.observablearray(); // bindings related batch processing $(function(){ $.ajax({ url:"../api/master_list.php", type:"get", data:{mastertype: '1'}, cache:false, success:function(country_l...

Phonegap Build facebook Connect Plugin (android) -

i have strange problem using facebook plugin phonegap build. sounds certificate problem can't figure out. i tried sample code found here : github.com/amirudin/pgb-fbconnect i followed instructions in readme.md file. when first start android app , when click on "login" button, works fine , can connect myself facebook app. now, hit logout button. ok again, works. but if hit login button again, have facebook error message : "invalid android_key_parameter. key xxxxxxxxxxxxxx not match allowed key." but xxxxxx key in message not correspond key i've put in facebook app config panel. i have little video of problem here : dropbox video i don't understand why works fine during first login , fail during second 1 .... seems second time, signature change. help!! i created github repo if want test it. have change app_name , app_id in config.xml , app_id in index.html it's frustrating have "almost" works. did succeed in repr...