Posts

Showing posts from April, 2010

c++ - Returning different int values for main() -

this question has answer here: what should main() return in c , c++? 18 answers i've searched find answer specific question not find 1 matched. understand return 0 , return exit_success same thing of saying program ended successfully, if return 1 or return 2 or other int value matter? different int values mean different things compiler or returning int mean program terminated successfully, in case doesn't matter int value put in? (limited) knowledge, seems int main() needs return int in order terminate. wrong? thanks , apologize if asked before, wasn't able find it. from: http://en.wikipedia.org/wiki/exit_status "the specific set of codes returned unique program sets it. typically indicates success or failure. value of code returned function or program may indicate specific cause of failure. on many systems, higher value, more sever

php - ZF2 forms - insert and update forms -

this more of question of approach/best practice, specific technical question, come bit of guidance. my question surrounds zend framework 2 forms, , if should implementing different form insetting entities , updating entities. to outline simplified use case. let's have product table in database. each product has id ( product_id ) primary key , name ( name ). let's products storing come supplier provide me unique product id want use primary key in database. now, let's i've implemented product_fieldset , product_form , both of working nicely. form allow me specify product id , name , store in database. however, when user uses form update product name, rather insert new product, don't want them able edit product id database primary key. i can see how present form in update scenario 1 less field (the product id) implementing 2 forms , 2 fieldsets. how approach this? when using service manager/form manager pull forms, can't quite head around how/w

vb.net - Overflow or underflow in the arithmetic operation when clearing large Table -

i'm building large (>25,000 rows) table s. i receive dreaded overflow or underflow error somewhere above 25,000 rows. i've tried reset psuedo table = nothing table = new table table.rows.clear() now, reset line referenced in trace same error. how should problem handled? try calling garbage collector: gc.collect()

ios - Examining a method argument on a mock object with Kiwi -

i need following: i'm writing bdd tests client api following structure: @protocol myapiclientdelegate <nsobject> -(void)mycallbackmethod:(id)response; @end // begin: myapiclientspec.h spec_begin(myapiclientspec) describe(@"myapiclientapi ", ^{ __block myapi *api = nil; __block id delegatemock = nil; beforeeach(^{ delegatemock = [kwmock mockforprotocol:@protocol(myapiclientdelegate)]; api = [myapi apiclientwithdelegate:delegatemock]; }); aftereach(^{ delegatemock = nil; api = nil; }); it(@"should return json { result: 'ok', token: <some_token> }", ^{ [[api should] receive:@selector(mymethodcall:)]; [[[delegatemock shouldeventually] receive] mycallbackmethod:any()]; [api mymethodcall]; }); }); spec_end as can see in code above, i'm using any() check @ least there parameter sent delegate. is there anyway define function (or objectiv

xcode4 - Does archiving in Xcode include external files? -

i finished iphone app , submitted app store. afterwards, cleaning , realized hadn't copied 1 of image assets project directory. my question whether or not asset included in archive (and consequently, included app when delivered through app store?). effects whether or not resubmit app store (setting me 2 days because of new wait time). thanks!

html - How to get a Bootstrap dropdown submenu to 'dropup' -

i have bootstrap dropdown menu. last 'li' item submenu. how submenu dropup while full menu drops down? here's code: <div class="dropdown"> <a class="inputbara dropdown-toggle" data-toggle="dropdown" href="#">filter</a> <ul class="dropdown-menu" role="menu" aria-labelledby="dlabel"> <li role="presentation"> <a role="menuitem" href="#">text</a> </li> <li role="presentation"> <label>label name</label> <label>label name</label> <label class="checkbox">

Javascript delete cookie before reload or redirect -

i need delete cookie , then redirect. cookie doesn't deleted until redirect processed. problem if cookie still exists @ time redirect executed, redirect intercepted , sent page other 1 intended. (weird, know; long story) is possible trick browser , force deletion of cookie before redirect? jquery('div#paneld').click(function(){ document.cookie = 'sharedsession=; expires=thu, 01 jan 1970 00:00:01 gmt; domain=.example.com; path=/'; window.location.href = "www.example.com/x"; }); i discovered if perform ajax call anything, qualifies refresh purposed of deleting cookies. var fakeajax = new xmlhttprequest(); var = fakeajax.responsetext; fakeajax.open("get","ajax_info.txt",false); // file doesn't exist fakeajax.send(); note "false" in open line. asynchronous has set false (or other delay) allow time new info come , cookie deleted. update: ie doesn't requesting responsetext file doesn'

c# - ListBox TextBlock item alignment in Grid column Windows Phone -

i have problem horizontalalignment of textblock in listbox itemtemplate. part of code: <listbox x:name="meallist" itemssource="{binding meals}" > <listbox.itemtemplate> <datatemplate> <grid> <grid.columndefinitions> <columndefinition width="*"/> <columndefinition width="auto"/> </grid.columndefinitions> <textblock text="{binding name}" margin="10" grid.column="0" textwrapping="wrap" style="{staticresource phonetextsmallstyle}"/> <textblock text="{binding price}" grid.column="1" horizontalalignment="right" verticalalignment="center" style="{staticresource phonetextsmallstyle}"/> </grid> </datatemplate> </listbox.itemte

mySQL PHP print results from multiple rows -

this beginner php/sql question. basically, have database looks this poem_id | poem_content | poem_by | poem_hotscore ------------ ----------------- ----------- ----------------- 1 | blah bleh<br>b.| 4 | 5342.3920349 ------------ ----------------- ----------- ----------------- 7 | blah bluu<br>f.| 4 | 5003.3920382 ------------ ----------------- ----------- ----------------- 9 | blerp bloop foo| 34 | 4300.7281209 each poem has unique id has content is written member unique member_id has unique hotscore calculated cron job using reddit's hotscore ranking algorithm my question is: how can top 3 scores , display data these poems? the php code have far this: if ($rankerrows = $mysqli->prepare("select * poems order poem_hotscore desc")) { $rankerrows->execute(); $rankerrows->store_result(); while ($row = mysqli_fetch_assoc($rankerrows)) { pri

xml - Is this a valid path? -

i have ant build script build project. large takes 40 minutes run. instead of running 40 minutes , failing, i'd thought i'd ask stackoverflow community first. following legal? <property name="configdir" value="${basedir}/../server"/> the value of ${basedir} c:\workspaces\antbuild\stephen\buildresources i have .. in value because want access server folder, @ same level buildresources . if there way easier, please let me know. haven't yet found way extract c:\workspaces\antbuild\stephen , append /server end of it. there default environment variable? in xml ant. you should try : <property name="configdir" location="../server"/> from ant manual property task : sets property absolute filename of given file. if value of attribute absolute path, left unchanged (with / , \ characters converted current platforms conventions). otherwise taken path relative project's basedir , exp

python 3.x - Rect.colliderect cannot detect specific collision -

i trying make simple game, here full code: import pygame pygame.locals import * pygame.init() #define variables width, height = 940, 780 screen = pygame.display.set_mode((width, height)) grey = 87, 87, 87 white = 255, 255, 255 player = pygame.image.load("pics\goodcar.jpeg") keys = [false, false, false, false] playerpos = [0,40] green = 0,255,0 red = 255,0,0 color = red x1 = 0 x2 = 40 y1 = 940 y2 = 100 #main program while 1: screen.fill(0) road = pygame.draw.rect(screen, grey, (x1,x2,y1,y2), 0) traffic_light = pygame.draw.circle(screen, white, (640,90), 40, 1) screen.blit(player, playerpos) car_rect = player.get_rect() if traffic_light.colliderect(car_rect): print("its working") event in pygame.event.get(): if event.type==pygame.quit: pygame.quit() exit(0) if event.type == pygame.keydown: if event.key==k_right: keys[0]=true elif even

How can I simulate class/method friendship in Ruby? -

i remember (barely) in c++ create friend classes or methods, capable of accessing private members. frankly, never found feature particularly useful. now using ruby game development framework. i'm making simple node system (a node can contain other children nodes, , have parent node). my node class has #add_child(child) . thing is, when a node gets child b node, need set b 's @parent reference point a . inside #add_child(child) have call: child.set_parent(self) now b 's @parent variable points a . , works fine. but, #set_parent(parent) is meant used specific scenario . must called when #add_child(child) called. if used #set_parent(parent) out of context, node system may break. now find class/method friendship thing useful. if make #set_parent(parent) usable #add_child(child) , system wouldn't break if random programmer decided call #set_parent(parent) themselves. from few searches doesn't seem ruby has feature explicitly. does ruby off

winforms - How to create radiobuttons programatically on a datagridview -

i'm using c# in visual studio 2010. have datagridview on winform. 1 column contain radio buttons only. each row have 3 radio buttons. i'm not sure understand needed that. appreciated. create datagridviewcheckboxcolumn , connect cellcontentclick event. use code: private void datagridview1_cellcontentclick(object sender, datagridviewcelleventargs e) { if (e.columnindex == 0)// checkbox column { object curr = datagridview1[e.columnindex, e.rowindex].value; if (curr == null || (bool)(curr) == false) { (int = 0; < datagridview1.rowcount; i++) { if (i != e.rowindex) { datagridview1[e.columnindex, i].value = false; } } } } }

javascript - How do I find the value of a variable in a specific string in jquery? -

this kinda confusing best... so writing program when clicks on text, subtracts amount total. example html this.... <form> <input type='number' name='namea' id='ida' step='0.01'> </form> <div id='diva></div> and javascript/jquery looks this... $('input[name=namea]').change(function(){ var itemvalue = this.value; $('#diva').prepend('<p class = "pa">blah blah ' + itemvalue + 'blah blah.</p>'); }); var total = 100; and part confused on.. $('.pa').click(function() { //i want find itemvalue of 1 click on , subtract total. }) so can find current value of itemvalue... how find of string prepend few strings ago. thanks in advance help. since clicking on dynamically added element, can store itemvalue data element ex jquery(function($){ $('input[name=namea]').change(function(){ var itemvalue = this.value;

java - Save image Uri as an image -

so doing receiving data intent app. getting image attempting save it void savefile(uri sourceuri) { string sourcefilename= sourceuri.getpath(); file mediastoragedir = new file(environment.getexternalstoragepublicdirectory(environment.directory_pictures), "photosaver"); bufferedinputstream bis = null; bufferedoutputstream bos = null; try { bis = new bufferedinputstream(new fileinputstream(sourcefilename)); bos = new bufferedoutputstream(new fileoutputstream(mediastoragedir, false)); byte[] buf = new byte[1024]; bis.read(buf); { bos.write(buf); } while(bis.read(buf) != -1); } catch (ioexception e) { } { try { if (bis != null) bis.close(); if (bos != null) bos.close(); } catch (ioexception e) { } } sendbroadcast(new intent(intent.action_media_mounted, uri.parse("file://" + new file(environment.getexternalstoragepu

windows - Copy Files using a batch file -

i need copy set of files mentioned in loop location each file copied directory named after file name. example : need copy file1.txt path abc def\file1\ ; file2.txt path abc def\file2\ i have been trying use following loop achieve same thing. there seems syntax error doing. because of hurry deliver this, not explore before posting here. searching solutions in parallel. please let me know issue code sample below for %%file in (de.txt en.txt es.txt fr.txt it.txt ja.txt nl.txt pt.txt zh_cn.txt) set name=%file%.* echo f | xcopy /i /y "c:\textfiles\%name%.txt" d:\textfiles\%name%\languagefile.txt done try command line for %f in (de.txt en.txt es.txt fr.txt it.txt ja.txt nl.txt pt.mo zh_cn.txt) echo xcopy "c:\textfiles\%~nf.mo" "d:\textfiles\%~nf\%~nf.mo" or in batch file for %%f in (de.txt en.txt es.txt fr.txt it.txt ja.txt nl.txt pt.mo zh_cn.txt) echo xcopy "c:\textfiles\%%~nf.mo% "d:\textfiles\%%~nf\%%~nf.mo"

select - Change column in sql -

i have table match: id (int) id_match (int) id_player (int) attend (bit) goals (int) when write select * match i have this: id id_match id_player attend goals 1 69 1 10 1 2 2 70 1 11 0 0 and want have this: id_player id_match attend goals 10 1 1 2 have idea? try : select top 1 id_player ,id_match ,attend ,goals table_name order id asc

android - Flag similar to FLAG_ACTIVITY_CLEAR_TASK in API 8 -

my app has activity triggers b , b in turn triggers c. activity launcher intent flag android:nohistory="true" in manifest file. shows splash screen. after 2 seconds triggers b intent flag flag_activity_no_history. b triggers c without intent flag. stack have activity c. in activity c, whenever pressed trigger activity b. stack should have activity b alone. should not have trace of other activity. i have used following code in activity c. flag flag_activity_new_task available api 11. app should supporting devices api 8. kindly assist me correct intent flags achieve explained scenario code: intent dragdropintent = new intent("android.intent.action.dragdrop"); dragdropintent.addflags(intent.flag_activity_clear_task); dragdropintent.addflags(intent.flag_activity_new_task); i agree starting activity c without nohistory help. t technical constraints don't want that. in advance if c goes b, should not use flag_activi

spannablestring - special images displaying when using spannable in android -

Image
hello everyone,iam using following code,while using code pigeon image displaying pls suggest me how remove one spannablestringbuilder stringbuilder = new spannablestringbuilder(); stringbuilder.append(""); stringbuilder.append("\n"); stringbuilder.append(vid_namearr[position]); stringbuilder.append("\n\n"); stringbuilder.append(vid_descarr[position]); tv.settext(stringbuilder); while removing custom font displaying box

php - pass multiple variable to bootstrap modal -

can pass multiple variable bootstrap modal? here code : p>link 1</p> <a data-toggle="modal" id="1" class="push" href="#popresult">test</a> <p>&nbsp;</p> <p>link 2</p> <a data-toggle="modal" id="2" class="push" href="#popresult">test</a> click links pop bootstrap modal <div class="modal hide" id="popresult"> <div class="modal-header"> <button class="close" data-dismiss="modal">×</button> <h3>modal header</h3> </div> <div class="modal-body" style="display:none;"> <p>some content</p> </div> <div class="modal-footer"> <a href="#" class="btn" data-dismiss="modal">close</a> <a href="#" class="btn btn-primary&qu

java - Spring mvc calling controller from jsp results in wrong url -

i new in developing spring mvc. trying call controller jsp file. gave requestmapping annotation controller, when try call mainview.jsp found on url: (i testing on localhost) "/airlinedb_spring/views/mainview.jsp" (this works fine), project name disappears url , address gives me 404: "/passengers/" don't know why "airlinedb_spring/" disappears link, looks main problem. my controller code: @controller @requestmapping(value="/passengers") public class passengercontroller{ @suppresswarnings("unchecked") @requestmapping(method=requestmethod.get) public string list(model model) { list<string> tl = new arraylist<string>(); tl.add("one"); tl.add("two"); tl.add("three"); model.addattribute("testlist", tl); return "mainview"; } my jsp file's code is: <html> <head> <meta http-equiv="

PHP: locale-dependent float to string cast -

i'm sitting on machine en_us locale , piece of php code setlocale(lc_all,'de_de.utf8'); var_dump((string)1.234); returns string(5) "1.234" whereas on colleague's machine has german locale, returns string(5) "1,234" why heck php use locale when typecasting floats strings? how can disable it? i'd have function return string(5) "1.234" on machines, regardless of locale settings. secondly , less important: why php ignore setlocale on machine? why heck php use locale when typecasting floats strings? that's it's behaviour how can disable it? you can't (as far know). you may set locale en_us if have locale installed. i'd have function return string(5) "1.234" on machines, regardless of locale settings. you have 2 options: 1) number_format(1.234, 3, '.', ''); 2) sprintf('%.3f', 1.234); in both cases have specify how may decimal digits w

newly created template's templateDetails.xml is not working in joomla 1.5 -

i've created joomla templates. instructed have placed files , folders inside , linked css file in index.php when cut text in templatedetails.xml still showing previous in browsers , @ positions after doing clean refresh. why taking position , css, i'm surprised. edit as per comments have been placing templatedetails.xml contents <?xml version="1.0" encoding="utf-8"?> <!doctype install public "-//joomla! 1.5//dtd template 1.0//en" "http://www.joomla.org/xml/dtd/1.5/template-install.dtd"> <install version="1.5" type="template"> <name>bini7a</name> <creationdate>mon, jun-10, 2013</creationdate> <author>bhojendra rauniyar</author> <authoremail></authoremail> <authorurl></authorurl> <copyright>bhojendra rauniyar</copyright> <license>gnu/gpl</license>

win32com - Python - Create Shortcut with arguments -

using win32com.client, i'm attempting create simple shortcut in folder. shortcut have arguments, except keep getting following error. traceback (most recent call last): file "d:/projects/ms/ms.py", line 153, in <module> scut.targetpath = '"c:/python27/python.exe" "d:/projects/ms/msd.py" -b ' + str(loop7) file "c:\python27\lib\site-packages\win32com\client\dynamic.py", line 570, in __setattr__ raise attributeerror("property '%s.%s' can not set." % (self._username_, attr)) attributeerror: property '<unknown>.targetpath' can not set. my code looks this. i've tried multiple different variates can't seem right. doing wrong? ws = win32com.client.dispatch("wscript.shell") scut = ws.createshortcut("d:/projects/ms/testdir/testlink.lnk") scut.targetpath = '"c:/python27/python.exe" "d:/projects/ms/msd.py" -b 0' scut.save()

extjs4 - EXTJS 4: Selective Ajax Request Aborting -

in application have many ajax request executes every , then. have 1 executes settimeout user interaction. problem user interaction part. the scenario when user sets parameter , clicks button executes ajax request. if makes mistake parameter user adjust , execute again ajax request, previous request still on going. i want abort previous request without using abortall() because said before there other request should not interrupted. selecting request abort. how do that? please help. there property on ext.ajax autoabort : boolean whether new request should abort pending requests. defaults to: false available since: 1.1.0 set prop true on ajax sent user, not interfere setinterval ajax's. also, make sure have client side , server side validation, bad params avoided. solving bad params on client side quicker, cheaper , user friendly thing let user submit falsy data! ext.ajax.request({ url: '/echo/json/', params: { id: 1

winforms - MenuStrip control menu's location change when form size getting smaller -

i have menustrip control in windows form this: file edit view options update but when user changes size of form , when form getting narrow menus should this: file edit view options update is there property this? or should use other control makes possible want. can try in visual studio's dynamic menu according window's size. any suggestions? thanks just set layoutstyle property of menustrip flow .

uiimage - UIBarButtonItem appearance difference between iOS 5 and iOS 6 -

Image
i'm using appearance proxy set background image of button in navigation bar. [[uibarbuttonitem appearance] setbackbuttonbackgroundimage:[[uiimage imagenamed:@"arrow-back-button"] resizableimagewithcapinsets:uiedgeinsetsmake(0., 9., 0., 0.)] forstate:uicontrolstatenormal barmetrics:uibarmetricsdefault]; this works great ios 6, looks absolutely perfect. in ios 5, however, background image starts repeating, if button taller or something. ios 5: ios 6: the image used (with coloured background highlight size). can me make button correct in ios 5? edit: here result if don't use resizableimagewithcapinsets: . the tiling behavior experiencing normal ios 5.x. behavior knows how resize image. don't know why seems resize in 5.x not in 6.x, way fix behavior in ios 5.x make png same size background of uibarbuttonitem (with alpha filler) , set non-resizable background image.

r - How to draw a straight line in heatmap plot -

i making heatmap data , want add straight line between each set of samples. seems abline doesn't work on heatmap . any idea function can use purpose? you have use add.expr argument. example found here might usefull: x <- as.matrix(mtcars) rc <- rainbow(nrow(x), start=0, end=.3) cc <- rainbow(ncol(x), start=0, end=.3) hv <- heatmap(x, col = cm.colors(256), scale="column", rowsidecolors = rc, colsidecolors = cc, margin=c(5,10), xlab = "specification variables", ylab= "car models", main = "heatmap(<mtcars data>, ..., scale = \"column\")", # important bit here add.expr = abline(h=5, v=2))

python - How to write a function that can print the name and value of its argument? -

this question has answer here: printing names of variables passed function 4 answers it useful debugging have function thus: a = np.arange(20) debug_print(a) the above should print variable: val: [...] thanks lot. try following code: import inspect import re def debug_print(*args): lines = ''.join(inspect.stack()[1][4]) matched = re.search('debug_print\((.*?)\)', lines).group(1) names = map(str.strip, matched.split(',')) name, value in zip(names, args): print('{} = {}'.format(name, value)) = 1 b = 2 debug_print(a, b) debug_print('a') debug_print('a,aa') # not work case.

java - Private and Public Key -

when create user create private , public key. public key token id user. private key used encrypt , decrypt of data. when user login, android app call rest web service , after validation return private , public key. using private key app can create signature. is correct way? using http not https. is correct way? no. i using http not https. why? can't see why don't use https else. it's solved problem. to correct mis-statements: the private key used decrypt data only, , create digital signatures. the public key used encrypt data , verify digital signatures. the public key of no use user token, because is, err, public. you need learn lot more pki presently appear know.

asp.net mvc - Will .Remove on entity framework perform a Cascade delete by defualt -

something strange happen. have table named group have one-to-many relation table named usergroups. now using entity framework .remove method. able delete group have users, although when try similar operation directly on database raise exception (that group have child records!!!) idea happening !!!. the action method looks :- [httppost, actionname("delete")] public actionresult deleteconfirmed(int id) { try { var v = grouprepository.find(id).name; grouprepository.delete(id); grouprepository.save(); return json(new { issuccess = "true", id = id, description = v }, jsonrequestbehavior.allowget); // return redirecttoaction("index"); } catch (nullreferenceexception) { //modelstate.addmodelerror(string.empty, " record might have been deleted.please refresh page.");

javascript - Simple dojo example Error: this.domNode is null -

referring jsfiddle's [code][1] cswing, why indicate "typeerror: this.domnode null (26 out of range 15) in dojo.js". here code copied cswing, learning , testing, <!doctype html> <html> <head> <style> html, body /*standard layout every dojo webpage*/ { width: 100%; height: 100%; padding: 0px; margin: 5px; overflow: hidden;/*no scrollbar used*/ } #standby { position: absolute; top: 50%; left: 50%; width:32px; height:32px; margin-top: -16px; margin-left: -16px; /* width: 300px; height: 300px; background-color: #e7e7e7; */ } </style> <link rel="stylesheet" href="../dojo1_8/dijit/themes/claro/claro.css"> <script>dojoconfig = {parseonload: true}</script> <script src="../dojo1_8/dojo/dojo.js"></script> </head> <body class="claro"> <div id="standby"> <div id=&q

category theory - Pithy summary for comonad. (Where a monad is a 'type for impure computation') -

in terms of pithy summaries - this description of monads seems win - describing them 'type impure computation'. what equivalent pithy (one-sentence) description of comonad? "a type context-dependent computation" alternatively, better "pithy description" monads might 'type output impurity', in case pithy description comonads 'type input impurity'. (if interested in comonads, more introduction given in talks slides of mine: http://www.cl.cam.ac.uk/~dao29/talks/comonads-and-codo-talk-dorchard-2011.pdf )

libtool don't compile Fortran to shared library -

i need use libtool compile fortran library, because need static , shared version, compilation won't work in same way of c library. in case of c library: $ cat hello.c #include <stdio.h> int hello() { printf("hello\n"); return 0; } $ libtool --tag=cc --mode=compile gcc -c hello.c libtool: compile: gcc -c hello.c -fpic -dpic -o .libs/hello.o libtool: compile: gcc -c hello.c -o hello.o >/dev/null 2>&1 $ nm .libs/hello.o u _global_offset_table_ 0000000000000000 t hello u puts as can see in example above libtool has add -fpic , object has _global_offset_table_ . in case of fortran library: $ cat hello.f function hello () write (*,*) "hello" endfunction hello $ libtool --tag=fc --mode=compile gfortran -c hello.f libtool: compile: gfortran -c hello.f -o .libs/hello.o libtool: compile: gfortran -c hello.f >/dev/null 2>&1 $ nm .libs/hello.o

Reading a 6MB csv file in PHP - Memory exhausted -

i'm trying open/read 6mb csv file php so: $lines = file("/path/to/my/file.csv"); but i'm getting following error: php fatal error: allowed memory size of 1073741824 bytes exhausted (tried allocate 6461150 bytes) in /path/to/php_file.php on line 488 as can see, our php memory settings set 1gb (dedicated server, not limited shared hosting package etc). my question should 6mb csv file really using over 1gb when read variable (array). i'm bit confused because i'm sure i've opened larger csv files php before without problems on server. shouldn't make difference we're using php 5.3 on ubuntu 12.04 server . you should process csv line line prevent memory exhaustion. try this: $f = fopen("my.csv", "r"); if(true === is_resource($f)) { while(false === feof($f)) { $line = fgetcsv($f, 8192); // data here } fclose($f); } using fgetcsv() parse csv far easier using file().

how to read events from google calendar in titanium -

i developing app ios/android in need read events google calendar. started oauth 2.0 titanium , got access token how suppose list of calendars , events using access token. i tried this:- var url = "https://www.googleapis.com/calendar/v3/users/me/calendarlist?access_token = "+accesstoken; var xhr = ti.network.createhttpclient({ onload: function(e) { var calendar = json.parse(this.responsetext); ti.api.debug(this.responsetext); }, onerror: function(e) { ti.api.debug(e.error); alert('error'); }, timeout:15000 }); xhr.open("get", url); xhr.send(); it give me "authentication needed" error. any help? in advance

cookies - Having trouble with codeigniter check box on remember me button -

i storing username , password in cookie have little trouble remember me button want when user check check box cookie store values else log in user problem here when put check in controller wont work know problem in if condition please 1 sort me out problem or correct syntax thankful. here code of controller , view. function verifying(){ $data=array( 'username'=>$this->input->post('username'), 'password'=>$this->input->post('password') ); if($this->input->post('remember_me')=="checked") { $cookie = array( 'name' => 'username', 'value' => $this->input->post('username'), 'expire' => 86500, 'secure' => false ); $cookie1 = array( 'name&#

xpages - "Query not understandable"- Using NOT in a pages view search -

when using not operator error occurs. querystring example: cat and dog not fish querystring works: cat and dog and not fish according not should replaced and not domino http://publib.boulder.ibm.com/infocenter/domhelp/v8r0/index.jsp?topic=%2fcom.ibm.notes85.help.doc%2fsch_refine_query_r.html server returns following error: query not understandable is bug or missing point? obviously example works users not no, it's not bug. document explicit. says cannot put not in between search terms. train users accordingly.

What is the equivalent of Cocoa's NSRange struct on Android (Java)? -

what equivalent of cocoa's nsrange struct on android? typedef struct _nsrange { nsuinteger location; nsuinteger length; } nsrange; i'm trying find java class cannot find anything. you can use java class : class javansrange { public integer location; public integer length; } nsinteger ==> integer

mysql - PHP $_SESSION value is not setting correctly -

i have simple login page in php looks provided username , password in mysql database , sets php $_session variable if user found. works fine mostly, except $_session['user_type_id'] has value of 1 no matter value of $row[0]["user_type_id"]. var_dump ($row[0]["user_type_id"]) in code below confirms has correct value, var_dump($_session) (alongside first var_dump) shows $_session['user_type_id'] 1. the $row value int while $_session value string, don't know if relevant. thing can think of i'm resetting session variable somewhere else don't recall doing , can't find happening anywhere. i'm trying use value control permissions. can see i'm going wrong? here session code public static function new_session ($username, $pw, $inactive) { $db = mydb::getconnection(); $statement = $db->prepare('select * users username = :parameter1 , `password` = :parameter2'); $statement->bindvalue(':param

c# - ASP.NET MVC site with forms authentification and Active Directory -

i'm quite novice asp.net mvc 3. i have asp.net mvc website uses windows authentication , active directory. now, have allow users log out. why have pass forms authentication. possible use using of active directory? i tried ricardo suggested in his post error: when launch website, i'm automatically redirected logon page error message 401.2.: unauthorized. there specific configurations in iis allow forms authentification? n.b: if enable anonymous authentification too, home page appears fine. however, when click on logon, fill credentials , press on login button, error ldaperr: dsid-0c0906e8, comment: in order perform operation successful bind must completed on connection., data 0, v1db1 i deduced anonymous user can't login through ad... it's true?

mysql - Sync Local Database data to a remote Database -

i'm having system runs online. have make system run in localhost. original online system should updated once day. know tool can transfer local database data remote database mysql use mysqldump native mysql tool create dump database , restore on other side ! (but depends on database size) or can use replication delay window! for how replicate mysql database follow article here !

Spring MVC - OSGi integration without Spring-DM -

is possible integrate spring mvc osgi http services "without" spring-dm? edit: clear, mean is possible initialize spring container manually , register appropriate servlets via http service? thanks in advance! sure, in osgi bundle activator ( implement bundleactivator ) can create spring context manually. there bunch of ways that . have spring applicationcontext , osgi bundlecontext , can whatever need do.

gwt - JSNI - invoking native method from another native method -

how call native on button click of native method? can call more 1 native method single native method on button click yes can it. sample code: public void onmoduleload() { exportsayhello(); button btn = new button("click"); btn.addclickhandler(new clickhandler() { @override public void onclick(clickevent event) { buttonclicked("vartika"); } }); rootpanel.get().add(btn); } public static native void exportsayhello() /*-{ $wnd.sayhellofunction = $entry(@com.gwt.test.client.gwttestproject::sayhello(ljava/lang/string;)); }-*/; public static native void buttonclicked(string value)/*-{ $wnd.sayhellofunction(value); }-*/; public static native void sayhello(string value)/*-{ $wnd.alert("hello " + value); }-*/; steps follow: export method sayhello() javascript using jsni now call native method buttonclicked() using same name sayhellofunction exported javascript . re

Xquery - sequential number -

i have xml document following data. need display this. every new plant attribute called id should added display sequential number. first plant 1, second type of plant 2 , on. not sure start...any guidance appreciated. <catalog> <plant> <common>abc</common> <botanical>mno</botanical> <zone>4</zone> <light>mostly shady</light> </plant> <plant> <common>pqr</common> <botanical>fgh</botanical> <zone>3</zone> <light>mostly shady</light> </plant> </catalog> output should : <catalog> <plant id="1"> <common>abc</common> <botanical>mno</botanical> <zone>4</zone> <light>mostly shady</light> </plant> <plant id="2"> <common>pqr</common> <botanical>fgh</botanical> <zone>3</zone> <light>mostly shady</light> </plant>

ruby on rails - upload paperclip attachment to s3 using fog gem for specificaly one model -

i using fog gem upload paperclip attachmets s3. config file. attaches every models attachments s3. trying implement on 1 model... couldnt find documentation of fog paperclip. config.paperclip_defaults = { :storage => :fog, :fog_credentials => { provider: "aws", aws_access_key_id: "aws_access_key_id", aws_secret_access_key: "aws_secret_access_key" }, :fog_directory => "bucket_name" } the best way define storage facilities each model (i think) by defining defaults in environment file, you're going define settings models. can use code each model: #app/models/your_model.rb :styles => { :medium => "x300", :thumb => "x100" }, :default_url => "your_url", :storage => :s3, :bucket => '******', :s3_credentials => s3_credentials #config/initializers/s

html - SVG added to DOM using javascript is not visible. -

i have valid svg file verified opening in image viewer. i tried adding svg html file using javascript code d3.xml("assets/abc.svg", function(xml) { document.body.appendchild(xml.documentelement); }); i check html source , can see svg added in html. svg not visible on page. idea reason? note : d3 working fine. the svg valid. the svg getting added dom structure within body.' its not visible in both chrome , firefox. works ok me in ie/ff/ch. have valid svg, following in root svg: <svg xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" ...> if have namespace, problem svg not formed correctly. or possibly, svg not viewable i.e. display="none" or viewbox tiny

c# - Accessing list in xml -

xml data structure: <cpt xmlns="http://www.example.org/genericclientprofile" xmlns:ns2="http://www.bosch-si.com/finance/cts/cpt/2" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://www.example.org/genericclientprofile genericclientprofile.xsd"> <header> <serviceid>cpt-uk</serviceid> <versionid>1.0</versionid> <brandcode>rbs.ada</brandcode> <creationtime>2013-09-24t16:56:52.985+02:00</creationtime> </header> <clientprofile bpkey="19933" id="1bb26568-1df3-4206-8cea-fb4614bf0a6a" createdby="barbourt" lastmodifiedby="mannc" documentstructureversion="v3_2" lastmodifiedat="2013-09-23 15:40:49.873" createdat="2013-09-23 10:07:33.608"> <section xmlns="" id="cd21fbb5-da1b-485d-8909-a8392fd5ad5c" name="globalclientfacts"> <

Hudson trigger build periodic event Poll SCM is selected -

Image
i configured hudson clearcase , able trigger build when checkin happened on branch real issue facing after triggering build build happening on every 1 minute periodically i want avoid periodic build , need 1 build when checkin happens to poll every 1 minute, cron should like: */1 * * * *

ios - Why doesn't autolayout work with container view -

Image
i using container view in application having strange issue regarding autoresizing of view. here snapshots of demo application building. the below image shows doing normal view of normal iphone view size. this view resizes correctly constraints added. now here using container view has size of 150*280 , have used same constraints above. here shows snapshot of portrait view no issues in navigator. but when change orientation gives following warning. how solve issue? thanks i have noticed interface builder doesn't refresh elements placed via constracints correctly when changing orientation viewontroller. if click on yellow warning icon , select "update frame", chances display properly. on actual device should display properly.

publish subscribe - meteor.js: understanding publishing -

i started meteor, , 1 thing still don't understand (not @ least) publishing mechanism. example, consider following code (i have disabled autopublish btw): file: client/lib.js var lists = new meteor.collection('list'); meteor.subscribe("categories"); template.categories.lists = function () { return lists.find({}, {sort: {category: 1}}); }; file: server/lib.js: var lists = new meteor.collection('list'); meteor.publish("categories", function() { return lists.find({},{fields:{category:1}}); }); 2 questions: should define in every file lists collection ? how meteor.subscribe("categories"); knows update lists variable ? an other questions have following code: file: client/lib.js: meteor.autosubscribe(function() { meteor.subscribe("listdetails", session.get('current_list')); }); file: server/lib.js: meteor.publish("listdetails", function(category_id){ return lists.find

mathematical optimization - Can the genetic-algorithm in Matlab pass a second return value from the fitness-function to the constraints? -

i simulating batch evaporator in matlab. genetic algorithm varies several starting variables x (such size, max. mass of working fluid, overall number of evaporators used ...) , goal maximize efficiency. function evaporator(x) returns negative efficiency minimized algorithm. besides efficiency, there several other values calculated. 1 duration of simulated cycle (not runtime of calculation itself!). constraint, duration of whole evaporation cycle should, depending on number of evaporators, not short (e.g. if 3 evaporators used, whole cycle should take @ least 3*5s = 15s). know can use nonlinear constraints option of ga ( nonlcon ). in case have same calculations evaporator(x) again, return calculated duration time. problem is, have call external dll several thousand times per run , calculations become slow. therefore want avoid running calculations twice. somehow possible, evaporator(x) returns both negative efficiency , duration @ same time? ga should minimize negative effici

webforms - Exception in executing publishing in VS2013 -

i have asp.net web forms template individual accounts without modifications. when try publish application web server i'm receiving following error: exception in executing publishing: cannot load file or assembly 'microsoft.visualstudio.web.azure.contracts, version=2.0.0.0, culture neutral, publishkeytoken=b03f5f7f11d50a3a' or 1 of dependencies. system cannot find file specified. has else ever received error? i'm getting error message after right click on project , select 'publish'. i've done googling haven't found solutions. i'm not sure if matters, version of vs i'm using visual studio professional 2013 , webforms project .net 4.5 any or direction appreciated. thanks! you need install windows azure sdk .net (vs 2013) following these steps: go http://www.windowsazure.com/en-us/downloads , on click “vs 2013 install” link under .net category download , install windows azure sdk installer uses microsoft’s wpi (web platf

sql - Exclude row when the value in column B is present somewhere (in another row) in column C -

as title describes i'm looking way exclude entire row select clause when value in column b of row present anywhere in column c of same table. select col_a, col_b, col_c table col_b not in (select col_c table) should it.

IIS returns 503 on ASP.NET MVC -

i have asp.net mvc site. site has been copied c:\mywebsite i made app pool aaa this, user account domain. i granted user account acl rights c:\mywebsite read&execute & list. after visit website, 503 error service not available. the error in system event log says: the identity of application pool aaa invalid. user name or password specified identity may incorrect, or user may not have batch logon rights. if identity not corrected, application pool disabled when application pool receives first request. if batch logon rights causing problem, identity in iis configuration store must changed after rights have been granted before windows process activation service (was) can retry logon. if identity remains invalid after first request application pool processed, application pool disabled. data field contains error number. verify password used when added user app pool. cached , if wrong not fix self, try re-authenticate , associate. che

linux - 'tee' device: Can i pipe to a FIFO and sample the data when i wish -

i piping sequence through pipe program (mkfifo) on linux. there way me sample data being read, periodically , see what's going on? seq 99999999 -1 00000000 >/tmp/foo pyrit -r cap/zutums-01.cap -i /tmp/foo attack_passthrough how see in sequence whenever feel it. don't want write disk or stdout. use strace that's overkill. i recommend use pipe viewer it can give such info as: time elapsed percentage completed (with progress bar) current throughput rate total data transferred eta

iphone - iOS 7.1 animation bug -

yesterday updated iphone 5 ios 7.1 , found strange bug in current application. there few uinavigationcontrollers . after few transition in animation of transition become fast, there no animation @ all. more strange system animation became fast, default uitablecell animation, modal window animation , on. does know this? on device 7.0.6 there no such problem. looks starts happen after few calls of: [navcontroller setviewcontrollers:popviewcontrollers animated:animated]; ps: 1 more thing - app still using ios 6.1 sdk . pps: don't use custom default animations. update: 7.1 sdk problem still exists. i have similar problem after updating iphone ios 7.0.3 7.1. go , forth several times using navigation bar , after few tries there no transition animation. animations broken when happens, eg. device rotation animation. after reaching state, few more , forth transitions cause crash. edit 3: in case problem because of accessing gui objects background queue. if exper

ssdt - SQLPackage error: An item with the same key has already been added -

i error sqlpackage: "an item same key has been added" meaning? google won't me.. "c:\program files (x86)\microsoft sql server\110\dac\bin\sqlpackage.exe" /action:deployreport /sourcefile:"xxx.dacpac" /profile:"publish.xml" outputpath:"report.xml" generating report database 'xxx' on server 'srv'. * item same key has been added. no output file created. generate script visual studio works (i script). have tested 3 projects in same solution. 1 creates deploymentreport-file. publish works. i ran issue. else gets this, try following. delete [project].dbmdl file in root of project folder. close , re-open project. clean solution/project. build dacpac again. publish/script/report dacpac. i believe related cache of dependancies becoming corrupt.

c++ - static link boost with g++ on MacOS -

i'm building project in c++ using fltk toolkit , have included boost libraries serialisation , statically link them cannot guarantee existence of boost libraries on other machines. i re-ran install commands boost download so: sudo ./b2 link=static sudo ./b2 install link=static and compiling project so g++ `fltk-config --use-forms --use-gl --use-images --ldflags --cxxflags` xxxx.cpp -l/opt/local/lib/ -wl, -bstatic -lboost_iostreams -lboost_serialization -wl, -bdynamic -o program_name but failure , output ld: file not found: collect2: ld returned 1 exit status i'm not sure here, have guidance? you have space in -wl, -bstatic . remove space, e.g. -wl,-bstatic . same applies -wl, -bdynamic .

c# - How to run a SpecFlow test through a test harness? -

good afternoon/morning/evening folks, i wondering possible me "execute" specflow test via sort of test harness (not nunit)? previously test harness built ran ms unit tests calling methods within dll created when compiled tests. i'm assuming same possible in theory since dll created, im wondering how of arguments etc. so in short, possible if there straight forward way or barking wrong tree? it's possible, i'm not clear why want to. specflow clever way of generating tests. these nunit tests, can switched use mstest. when save edits .feature file vs runs custom tool converts plaintext .feature.cs file contains code version of wrote nunit attributes applied methods. later, nunit runner (nunit, resharper, gallio, teamcity etc) loads dll , looks public methods marked [test] inside public classes marked [testfixture] . these methods called. there nothing stop writing own runner, i'm not sure why that. nunit provides extensive reporting of

php - Mysql with variables and count method -

Image
first sorry if pushed in wrong place little confused first time? i trying create sql query retrieve count of id , set in variable got strange results. here code. set @order_count = 0,@refund =''; select @order_count := count(id) , @order_count @refund := (subquery) refunds, if(@refund > 0,( @order_count - @refund ), @order_count ) sold, wp_shop_orders o here screenshot of got. also when run command through php using mysqli returns second column empty value. thanks this problem addressed in mysql manual section on user-defined variables . in particular, here: as general rule, other in set statements, should never assign value user variable , read value within same statement. example, increment variable, okay: set @a = @a + 1; for other statements, such select, might results expect, not guaranteed. in following statement, might think mysql evaluate @a first , assignment second: select @a, @a:=@a+1, ...; howe