Posts

Showing posts from May, 2014

c# - Audit Logging Inserts -

i wondering if offer input implementation of audit logging inserts. need ensure transactional. i have audit dbset built upon following poco: public class audit { public int id { get; set; } public user user { get; set; } public datetime created { get; set; } public string type { get; set; } public int entityid { get; set; } public string message { get; set; } } i have dbset, users, when insert want create automatically add audit entity in audit dbset. consider following code: //var user = new user(); //user.created = datetime.now; //user.username = "testuser"; //user.password = "testpassword"; //datacontext.users.add(user); var post = new post(); post.created = datetime.now; post.title = "a sample post"; post.published = true; post.body = "some content goes in here..."; datacontext.posts.add(post); var audit = new audit(); audit.created = datetime.now; audit.user = currentuser.user; // logged in user audit.t...

android - Admob Live Wallpaper on Display? -

is there way display admob ad every hour or right on live wallpaper? i'm assuming mean general live wallpaper rather own. i don't think possible if technically possible, have figure out how display it. example, consider animated live wallpaper repaints each frame. i recommand using notification (or if must toast) mechanism since less intrusive , can use regardless of current live wallpaper.

c# - How to add service reference in client project? -

i totally new wcf please indicate if find doing totally wrong here. have created wcf service project (my service class dervied servicebase class) endpoint address binding set basichttpbinding. need create client application can call apis service. quesion in client application how can add service reference service. need publish service first under iis (which mean have have iis available on machine too) or there other way of adding service reference too. you need running service, metadata being published. can iis, other valid hosting option . i write simple console application self-host wcf service, reason. makes super easy debug, update service references during earlier phases of development, , can dramatically simplify work when working on client , server simultaneously.

data modeling - Dimensional modelling few questions -

i getting familiar dimensional model, started looking @ health claims process. trying acheive following: 1) ability report claims patient speciality , service provider (monthly, quarterly , yearly) 2) claims referring provider service provider 3) claims monthly payments received (1) , (2) 4) claims month of services (1) , (2) here dimsion model: factclaims charge amount payment amount service date key (fk) payment date key (fk) patient key (fk) service provider key (fk) facility key (fk) referred provider key (fk) dimension tables: dimserviceprovider serviceproviderid (sk) service provider name speciality dimpatient patientid (sk) name address dimdate dimfacility facilityid (sk, pk) facilityname facilityregion facilitystate questions : 1) should separate fact tables charges , payments? 2) not sure whether thinking correct referred provider key (which points dimserviceprovider) 3) rule of thumb combine of dimension tab...

dynamic - PHP directory rules of thumb? -

i'm trying make sure file paths robust can be, , knows hard-coding paths can disastrous in lot of cases. there general rules of thumb regarding referencing paths? concerning referencing above $_server['document_root']. i've been doing ../../(x100000), looks messy , hoping there cleaner way. thanks to current directory of running script do: str_replace('//', '/', str_replace('\\', '/', dirname(__file__) . '/')); this little bit hacky it's reliable afaik. but think not work windows unc paths (if use them)...

javascript - Using dijit.byId to get dijit.form.DateTextBox value -

inside alert(invalid date) coming , please tell me how can date value <html> <head> <link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/dojo/1.6/dijit/themes/claro/claro.css"/> <script src="http://ajax.googleapis.com/ajax/libs/dojo/1.6/dojo/dojo.xd.js" djconfig="parseonload: true"> </script> <script> dojo.require("dijit.form.datetextbox"); </script> <script> function callme() { var val = dijit.byid('fromdate_out').value; alert(val); } </script> </head> <body class="claro"> <div dojotype="dijit.form.datetextbox" require="true" id="fromdate_out" placeholder="from date" onchange="dijit.byid('fromdate').constraints.max =arguments[0];" ></div> <input type="button" onclick=...

Javascript+Canvas implementation of Game of Life not working -

i'm having problems javascript+canvas implementation of conways game of life. cells being created fine , canvas boxed representing cells being rendered fine. somewhere along way cells seems set alive & aren't toggling. life of me can't understand what's wrong. javascript code here , implementation here . can please tell me went wrong. ** * ** * ** * ** * ** * ** * ** * *** edit * ** * ** * ** * ** * ** * ** * ** * ** i think i've figured out whats wrong. i'm passing element of 2d array reallytoggle() function, - var reallytoggle = function(a) { //code } reallytoggle(cell[i][j]); i think problem lies in part of code. can tell me how can pass element of array function? so code pretty obscure , overly-complicated honest. creating grid of custom javascript function objects way over-engineering: need 2d boolean array. problems easiest solve if thought of 2 separate problems: problem space , world space. problem space area in solve actual p...

python - Need help splitting a string into 3 variables -

i split string of characters 3 variables. when run .split() ['aaa00000011'] . split like: var1 = aaa var2 = 0000001 var3 = 1 the user typing in these values command line on windows machine. my code: barcode = raw_input('please enter barcode') print "this barcode split up", barcode.split() are looking this? var1 = barcode[:3] # first 3 characters var2 = barcode[3:-1] # characters third next-to-last var3 = barcode[-1] # last character

ruby - Split text at character limit and return string array -

using cpp skills, have developed following old-styled recursive method split text string array nearest word break capped or limit character-count parameter ("limit"): #see below sample usage def split_at_limit(text, limit, result) slices = text.scan(/.{1,#{limit}}/m) return if slices.blank? first_slice = slices.first if first_slice.last == " " || (slices.length > 1 && slices[1].first == " ") result << first_slice slices.delete_at 0 split_at_limit(slices.join, limit, result) elsif slices.length > 1 first_slice_length = first_slice.length - 1 appendix = "" = 0 first_slice_length.times |i| break if first_slice[first_slice_length-i].chr == " " appendix = "#{first_slice[first_slice_length-i].chr}#{appendix}" first_slice[first_slice_length-i] = '' end first_slice = slices.first if == first_slice.length result << first_slice ...

c# - Get WPF ContextMenu to show on Winforms NotifyIcon -

i using winforms notifyicon there no wpf version, using contextmenu tutorial here: http://www.wpftutorial.net/contextmenu.html and using mouse placement code found in answer here: http://social.msdn.microsoft.com/forums/en-us/wpf/thread/8cdd4ef1-d31e-42ef-a30e-7b482c0fa163/ my main problem is, method: private void opencontextmenu(frameworkelement element) { if( element.contextmenu != null ) { element.contextmenu.placementtarget = element; element.contextmenu.isopen = true; } } how used? can tell me steps need show notifyicon thanks codeplex has wpf version of notifyicon . might meet needs better.

php - Take info of current page when pressing a button -

i have question php. sure has answered can't express search. so, have page user profile. in page there button. when press key want somehow take id of user the profile belongs. i think in jsp can request object, not sure. if it's form submit put user id in hidden input on page. like: <input type="hidden" name="user_id" value="<?php echo $your_user_id; ?>" /> then when click button submit form available in variable $_post['user_id'] if used post method or $_get['user_id'] if used method. if want without submitting form need use javascript make ajax call.

MongoDB should I create my own ID key column? -

in mongodb there seems default _id column, stores object id. should making own auto-incrementing id column reference across collections foreign keys? the default _id column primary key of document. , stores an objectid, can contain else, it's you. there reason why mongo developers use default primary key (it's more performant if multiple processes insert simultaneously) , if don't understand reasons better not experiment else. it foreign key.

data structures - Databases: More questions about (B-Tree) indexes -

i've been studying indexes , there questions pother me , think important. if can or refer sources, please feel free it. q1: b-tree indexes can favor fast access specific rows on table. considering oltp system, many accesses, both read , write, simultaneously, think can disadvantage having many b-tree indexes on system? why? q2: why b-tree indexes not occupied (typically 75% occupied, if i'm not mistaken)? q1: i've no administration experience large indexing systems in practice, typical multiprocessing environment drawbacks apply having multiple b-tree indexes on system -- cost of context switching, cache invalidation , flushing, poor io scheduling, , list goes up. on other hand, io inherently ought non-blocking maximal use of resources, , it's hard without sort of concurrency, if done in cooperative manner. (for example, people recommend event-based systems.) also, you're going need multiple index structures many practical applications, if you...

java - CardLayout not working properly -

i have written simple cardlayout example splitpane, combobox , few other panels containing buttons , label. import java.awt.borderlayout; import java.awt.cardlayout; import java.awt.container; import java.awt.eventqueue; import java.awt.event.itemevent; import java.awt.event.itemlistener; import javax.swing.jbutton; import javax.swing.jcombobox; import javax.swing.jframe; import javax.swing.jpanel; import javax.swing.jsplitpane; import javax.swing.jtextfield; import javax.swing.border.emptyborder; public class splitpane_test extends jframe implements itemlistener { private jpanel contentpane; final static string buttonpanel = "card jbuttons"; final static string textpanel = "card jtextfield"; jpanel cards; public static void main(string[] args) { eventqueue.invokelater(new runnable() { public void run() { try { splitpane_test frame = new splitpane_test(); //fra...

Converting Binary to Decimal using while loop in C++ -

i reading book on c++ , there task asks reader convert binary number (inputted user) decimal equivalent. far have following code, output 0. idea has gone wrong? #include <iostream> using namespace std; int main() { int x, b = 10, decimalvalue = 0, d, e, f, count = 1, counter = 0; cout << "enter binary number: "; cin >> x; x /= 10; while( x > 0) { count++; x = x/10; } while (counter < count) { if (x == 1) { f = 1; } else{ f = x % b; } if (f != 0) { if (counter == 0) { decimalvalue = 1; } else { e = 1; d = 1; while (d <= counter) { e *= 2; d++; } decimalvalue += e; } } x /= b; counter++; } cout << decimalvalue << endl; system("pause...

php - Codeigniter, problem with extended class methods -

it’s been while since don’t use ci , i’m starter doubt. edit: class my_controller extends ci_controller { public function __construct() { parent::__construct(); if(!$this->session->userdata('usuario')) { $this->load->view('login'); } } } class home extends my_controller { public function __construct() { parent::__construct(); template::set('title', 'login'); template::set('view', 'home'); } public function index() { $this->load->view('template'); } } what happens is user session invalid, load login view in home controller contructor method calling view home , loading both views on same page. don't put in hook, put in my_controller in __construct() method. http://codeigniter.com/user_guide/general/core_classes.html example: // file application/core/my_controller.php class my_controll...

asp.net - Dynamically re-size RadSplitter to displayed panes -

need re-size radsplitter control on webusercontrol total size of displayed (not collapsed) panes. for instance, have 2 panes displayed within radsplitter. each of these panes has height of 250px. if 1 of these panes collapsed, want radsplitter take space 250px in height. if both panes opened (none collapsed), want radsplitter take space 500px in height. needs able change in live environment that, if user opens or closes pane makes appropriate adjustments radsplitter's height property. any idea's...? thanks help! what listed onclientcollapsing event of splitter , within change height of main splitter div javascript.

java - send file then message through socket -

i trying send file client server. server receives file , send confirmation message client. my problem client becomes unresponsive when waiting confirmation. server : import java.net.*; import java.io.*; public class server { public static void main(string args[]) throws ioexception { int port = 1234; serversocket server_socket; server_socket = new serversocket(port); system.out.println("server waiting client on port " + server_socket.getlocalport()); // server infinite loop while (true) { socket socket = server_socket.accept(); system.out.println("new connection accepted " + socket.getinetaddress() + ":" + socket.getport()); try { byte[] b = new byte[1024]; int len = 0; int bytcount = 1024; string filename = "c:\\test\\java\\tmp\\sentfile.pdf"; fileoutputstream infile = new fileou...

jquery - Rendering JQPlot through PHP -

i have page generates html dynamically , echo of it. how can jqplot. can have multiple graphs on same page. see jqplot uses document.ready render it. generate required arrays php . how should can call php/javascript method / include , pass required parameters display chart? if have multiple charts should put document.ready , out php loop inside , call generic plot function can pass parameters ? something below $(document).ready{function(){ <?php loop generate required objects chart ?> call jqplot function generate chart <? > use php's json_encode generate javascript object in javascript tag : <script type="text/javascript"> var data = <?php echo json_encode($phpdata)?> ... ... process data jqplot, it's in js variable. </script>

Strange New Error when using FancyBox and jQuery -

possible duplicate: strange error when using fancybox , jquery i'm getting error when trying use fancybox firebug tells me c.easing[this.options.specialeasing && this.options.specialeasing[this.prop] || b] not function [break on error] this.options.show)for(var k in this.op...end(c.fx, {tick:function(){for(var a= – i'm positive paths script , style files correct. <script type="text/javascript" src="/javascript/jquery-1.4.3.min.js"></script> <script type="text/javascript" src="/javascript/jquery.mousewheel-3.0.4.pack.js"> </script> <script type="text/javascript" src="/javascript/jquery.fancybox-1.3.4.pack.js"></script> <script type="text/javascript"> $(document).ready(function() { $("#enlarge").fancybox({ 'titleshow' : false, 'transitionin' : 'elastic', 'transitionout' : 'elastic...

Multiple splits on a single line in Python -

i know if there more compact (or pythonic) way of doing several splits of input string. i'm doing: [a,bc,de] = 'a,b:c,d/e'.split(',') [b,c] = bc.split(':') [d,e] = de.split('/') i'd use regular expression library. don't need use lists unpacking, can use tuples below. import re regex = re.compile(r'[,:/]') a, b, c, d, e = regex.split('a,b:c,d/e')

httpclient - Logging into SiteMinder using Java -

as working on project making call url , url using siteminder every time make request url https://some-host/a/getmeta?id=10 it redirects me other url contains siteminder thing location: https://login.somehost.com/siteminderagent/nocert/1309460767/smgetcre d.scc?type=16777217&realm=-sm-documentum%20[12%3a06%3a07%3a4932]&smauthreason=0& method=get&smagentname=-sm-6d9ykpar83asdc5sb4kdjzthgfzid%2fyhfkbzwyvx5euegmi0doa ugvx6wok1dai3&target=-sm-http%3a%2f%2fsome-host%2fa%2fgetmeta%3fid%3d10 and if open link browser ask username , password , if provide username , password actual content back.. so how can authenticate everytime , using httpclient 4.1.1. well, can follow redirect, fill in fields , post form. take want go. the fields standard user , password fields siteminder. need ensure java code handles redirects , maintains cookie. commons-httpclient pretty easily.

mongodb - PHP 5.2.13 MongoCursorException 'duplicate key error index' -

i'm getting duplicate _ids when inserting documents our mongo database. intermittent problem happens under load (is reproducable test scripts). here's test code don't think i'm trying double-insert same object (i know php mongo driver adds _id field): // insert job $job = array( 'type' => 'cleanup', 'meta' => 'cleaning data', 'user_id' => new mongoid($user_id), 'created' => time(), 'status' => 'pending' ); $this->db->job->insert($job, array('safe' => true)); // <-- failz here i went on frenzy , installed latest stable (1.1.4) mongo driver no avail. isn't under heavy load. we're doing maybe 5 req/s on 1 server, 16m rec/s limit inc value isn't issue. any ideas appreciated. i'm hoping somewhere has used mongo php , inserted more 5 docs/s , had issue ;). -edit- on centos 5.4 x86_64, linux 2.6.18-1...

ruby - facebook like button using unobtrusive js in rails -

i've put facebook button on rails app adding following tag html.erb page: <div id="fb-root"></div> <script src="http://connect.facebook.net/en_us/all.js#appid=1419...&amp;xfbml=1"></script><fb:like href="" send="" width="100" show_faces="" font="" layout="button_count" action="recommend"></fb:like> and ... works ok big white space on page facebook sdk loading. so, thought i'd try putting in application.js file , running function after page loaded. problem can't work @ :) so far, i've kept "fb-root" div in html , i've placed following function application.js $(function() { $('#fb-root').after('<script src="http://connect.facebook.net/en_us/all.js#appid=1419...&amp;xfbml=1"></script><fb:like href="" send="" width="100" show_faces="" fo...

JSON Loop using jquery -

after reading questions here, still have difficulty on making loop through json results. here are: { "data": { "posts": [ { "post": { "id": "1", "user_id": "1", "title": "test content", "created": "2011-06-30" } }, { "post": { "id": "2", "user_id": "2", "title": "new test content", "created": "2011-06-30" } } ] } } how can post.title using $.each() ? $.each(jsonobject.data.posts, function(index, val){ alert(val.post.title); //do want title });

unbind socket connection C#/python -

what have: i have 2 socket client programs written in c#. i have 1 socket server program (not written me works) in python. the problem: the first c# socket client wrote works fine , can communicate python server client. can send data on no issue. wanted rewrite code make more object oriented, made second program same first in terms of done. the issue second 1 won't connect, saying this: system.net.sockets.socketexception: attempt made access socket in forbidden way access permissions. i googled , have come realization connection first connection hasn't been unbound. when did netstat -a , saw connection , said time_wait @ end. the question is, how unbind it? on c#/client side? fyi have tried closing/disconnecting/shutting down socket , none of worked. put in command connection.setsocketoption(socketoptionlevel.socket, socketoptionname.reuseaddress, true); upon instantiation of socket connection did not work either. would have on server side ...

How to use a reference variable in a jQuery? -

i learned using reference variable faster using $() every line of code (see previous question): jquery - okay use $('#elementid') everytime? . question how can use reference variable maximize power of jquery? please see example below: without reference variable: var valueofselected = $('#selectelementid option:selected').val(); with reference variable (pseudo-code): var selectelement = $('#selectelementid'); var valueofselected = $(selectelement).selectedoption.val(); note selectedoption.val() pseudo-code here. there such function anyway? you can use .find() find nested option . var selectelement = $('#selectelementid'); var valueofselected = selectelement.find('option:selected').val(); ...but because select element, can use val() [docs] method directly. var selectelement = $('#selectelementid'); var valueofselected = selectelement.val(); this give value of selected option .

focus - Disable focusable event for divider and list items on ListViewAdapter on Android -

i created list view based on: http://android.amberfog.com/?p=296 this custom list view allows insert custom header/divider on custom list adapter. i'm using style.xml list view , .xml files list item , list item header can added custom list view. one problem: can't seem control focus listed items. want disable focusable events listed items (i.e. avoid listed item have glaring orange highlight when focused on scroll events). i checked focus demos on apidemos project found in android sdk no avail (setting focusable=false either create view instance on activity or .xml). are there other ways disable focus listed items? by using selector can change or remove focus color of list items . here link this.. http://android-journey.blogspot.com/2009/12/android-selectors.html

How to specify default module in Zend Framework? -

by default zend framework specifies "default" module default module of application. want "frontend" module default module in app. how can this? in config file resources.frontcontroller.defaultmodule = "frontend" see http://framework.zend.com/manual/en/zend.application.available-resources.html#zend.application.available-resources.frontcontroller update you cannot "rename" default module. if you're interested in changing url structure, use custom routes. example resources.router.routes.frontend.route = "frontend/:controller/:action/*" resources.router.routes.frontend.defaults.module = "default"

javascript - Can't find error in JS code -

i have "bubble generator" working, not clearing bubbles , can't figure out why. been staring @ while now. specifically, of bubbles getting "cleared" float up, others aren't, , can't see why. argh! http://jsfiddle.net/dud2q/7/ (slowed waaay down can watch single bubble) logic flow (this describes code in fiddle): create imagedata array (long list of pixels) imgdata = ctx.getimagedata(0, 0, w, h); push new random bubbles onto beginning of "bubbles array" draws bottom-up: for(var i=0, l=generators.length; i<l; i++){ for(var j=0, m=0|math.random()*6; j<m; j++){ newbubbles.push( 0|generators[i] + j ); } generators[i] = math.max(0, math.min(w, generators[i] + math.random()*10 - 5)); } bubbles.unshift(newbubbles); loop bubbles drawn and: clear bubbles drawn in last loop setting alpha channel 0 (transparent): if(i<(l-1)){ x = 0|bubbles[i+1][j]; offset = y * w * 4 + x * 4; pixels[offset...

Unable to add a file under SDcard in Android Linux Emulator -

i trying add file under linux android emulator . followed following procedure $android_emulator/tools>./mksdcard -l 256m mysdcard.img $android_emulator/tools>chmod 777 mysdcard.img the mysdcard.img created read write permissions. in android emulator run as >run configurations>target -- selecting emulator/avd , in commandsline typing -sdcard "/android_emulator/tools/mysdcard.img after -l should give label name > ./mksdcard -h mksdcard: create blank fat32 image used android emulator usage: mksdcard [-l label] <size> <file>

How to set default selected options in magento product detail page -

i have requirement in getting product id external application product super_attribute options color,size. getting , can add cart option. but here actual requirement select requested options customer , redirect them product detail page in magento here can still enter optional text print. need set requested options in detail page , redirect them product detail page instead of adding cart. enter more details , addtocart manually. how can set selected options while loading itself. please me. thankfully built in themes. need know id of both attributes , values simple product included in configurable product. i've seen work configurable types might limitation. for each attribute make key=value pair combine attributes query string, eg. "123=345&678=890" append string hash fragment (not query). example official demo, note first option needs selected second work has 2 key/value pairs. http://demo.magentocommerce.com/zolof-the-rock-and-roll-destr...

c# - How to get the site content in french language -

i have site content in french language. now want these through httpwebrequest , httpwebresponse in console application using c#. public string getcontents(string url) { streamreader _answer; try { httpwebrequest webreq = (httpwebrequest)webrequest.create(url); webreq.headers.add(httprequestheader.acceptencoding, "utf-8"); webreq.useragent = "mozilla/4.0 (compatible; msie 6.0;windows nt 5.1;)"; webreq.contenttype = "application/x-www-form-urlencoded"; httpwebresponse webresp = (httpwebresponse)webreq.getresponse(); stream answer = webresp.getresponsestream(); encoding encode = system.text.encoding.getencoding("utf-8"); _answer = new streamreader(answer, encoding.utf8); return _answer.readtoend(); } catch { } return ""; } i content contain strange symbol squares etc. are sure web server responding utf-8 encoding? ...

is there a equivalent of StringBuilder for boolean in java? -

i want custom functions modify / toggle boolean variable. let's have code like if (ok2continue) { findandclick(new string[]{"id", "menubutton"});} if (ok2continue) { findandclick(new string[]{"src", ".*homeicon_calendar.*"}); } if (ok2continue) { findandclick(new string[]{"src", ".*cycle_templates.*"}); i want make sure flow of execution stops once of findandclick functions toggles variable ok2continue i managed functions modify string variable using stringbuilder . can same boolean type of variable? push code own method, , use return: if (findandclick(new string[]{"id", "menubutton"})) return; if (findandclick(new string[]{"src", ".*homeicon_calendar.*"})) return; if (findandclick(new string[]{"src", ".*cycle_templates.*"})) return; given method calls same, use loop: string[][] buttons = { {"id", "menubutton...

xml - Passing copy-of to a function? -

i need select copy of following nodes: <xsl:copy-of select="node1/node2/*" /> and need pass value of copy function processnodes receives string input parameter , return string processing, , write result as: <data> result of function </data> i thought can put <data> <xsl:copy-of select="myfunction:processnodes(node1/node2/*)" /> </data> but incorrect. may know correct syntax this? ps : document xml like: <node1> <node2> <html> <body> <p>my first paragraph.</p> <p>my 2nd paragraph. , paragrah has 2 lines.</p> </body> </html> </node2> </node1> and need write them <data> first paragraph. 2nd paragraph. , paragrah has 2 lines. </data> note 2 lines in 2nd paragraph merged 1 line. that why need copy-of tags <p> can pr...

c++ - How to produce a random number sequence that doesn't produce more than X consecutive elements -

ok, don't know how frame question because barely have idea how describe want in 1 sentence , apologize. let me straight point , can skip rest cause want show i've tried , not coming here ask question on whim. i need algorithm produces 6 random numbers may not produce more 2 consecutive numbers in sequence. example: 3 3 4 4 2 1 ^fine. example: 3 3 3 4 4 2 ^ no! no! wrong! obviously, have no idea how without tripping on myself constantly. is there stl or boost feature can this? or maybe here knows how concoct algorithm it. awesome. what i'm trying , i've tried. (the part can skip) this in c++. i'm trying make panel de pon/tetris attack/puzzle league whatever clone practice. game has 6 block row , 3 or more matching blocks destroy blocks. here's video in case you're not familiar. when new row comes bottom must not come out 3 horizontal matching blocks or else automatically disappear. not want horizontal. vertical fine though. i'...

vb.net - Stop VB from showing xml comment preview -

when create xml comment in c# , collapse see: <summary>... but in vb potentially see initializes fubble watzer. second line. having line on code can introduce lots of unwanted noise when trying debug class. there way turn off xml comment previews vb? unchecking generate xml documentation file on compile tab vb.net project should it. remember turn on again when finished if want have xml comments built. leaving off improve visual studio performance.

Is there an existing Google+ API? -

possible duplicate: is there google+ api? is there existing google+ api ? know if possible access "feed" api done facebook ... edit: there google+ api http://developers.google.com/+/api/ old post: no, api not yet available. http://www.readwriteweb.com/hack/2011/06/google-plus-puts-out-a-call-for-developers.php

c - Strange bug when compiling on 32bit -

i cannot reduce issue small test case. please git clone code here: https://github.com/tm1rbrt/chess.git commit b3055a45c28978b4a364 (head @ time of writing) or browse code here: https://github.com/tm1rbrt/chess on line 119 of gametree.c have line //score -= 1; // line breaks things! if uncomment break stuff seems in no way related it. happens when subtract or add negative number score variable. this wasnt issue when building on 64bit windows machine. on 32bit one. both outputting 32bit executable think. i have no idea why happen, can guess todo different size ints or something. know longshot if shed light grateful. edit i set magic variable not_evaluated 0xffffffff rather intmax when score unsigned int. causing issue. (when changed score signed int) what mean "will break stuff"? if it's crashing, you're using (whether planned, or accident) part of index / pointer makes write unallocated space. use tools valgrind or other overflow/und...

java ee - J2EE EJB3 webservice for image generation -

i need advice best solution on how make web service returns generated image. instance client gives yard id , service depending on business data generates image of yard (that's example). using ejb3 , jpa accomplish this. there's no problem reading data datasource , exposing ejb web service. worried 2 things - using awt in ejb , file i/o in ejb. awt in ejb? i've created bufferedimage , using java.awt.graphics2d draw image - lines, circles etc.. not drawing screen, bufferedimage willing pass client. question - idea that? if not best solution? said "the program violates enterprise javabeans specification using awt/swing." bad idea use awt in situation? said "an enterprise bean must not use awt functionality attempt output information display, or input information keyboard." mean awt used in different situations (like i"m not displaying on screen)? file i/o in ejb? i can't use i/o external files, files ar located in ejb jar file? poss...

nsfilemanager - What's the difference between path and URL in iOS? -

in class such nsfilemanager there 2 versions of practically every method. 1 paths , 1 urls. what's difference? , what's best practice converting url path. url includes protocol being used (http:// etc). path doesn't or doesn't need @ least.

controller - 2 render templates (from devise) on one page (rails 3) -

i've installed devise rails app, can go sign in page or sign page. want them both on welcome page... so i've made welcome_page_controller.rb following function: class welcomepagecontroller < applicationcontroller def index render :template => '/devise/sessions/new' render :template => '/devise/registration/new' end end but when go welcome page error: nameerror in welcome_page#index showing /users/tboeree/dropbox/rails_projects/rebasev4/app/views/devise/sessions/new.html.erb line #5 raised: undefined local variable or method `resource' #<#<class:0x104931c>:0x102749c> extracted source (around line #5): 2: <% @header_title = "login" %> 3: 4: 5: <%= form_for(resource, :as => resource_name, :url => session_path(resource_name)) |f| %> 6: <p><%= f.label :email %><br /> 7: <%= f.email_field :email %></p> 8: does knows solution problem? in advance! ...

xcode - ld: library not found for -llinphone -

i facing linker error in xcode, compiled iphone code in mac virtual machine (snow leopard 10.6.6) following instruction in readme file mac os, compiled successfully, now have run in xcode getting fallowing error. ld: library not found -llinphone collect2: ld returned 1 exit status command /developer/platforms/iphonesimulator.platform/developer/usr/bin/gcc-4.2 failed exit code 1 more detail of logs ld /users/mac/library/developer/xcode/deriveddata/linphone-hbezhyqawbboavbueofzjzfsukku /build/products/debug-iphonesimulator/linphone.app/linphone normal i386 cd /users/mac/desktop/iphone/linphone-iphone setenv macosx_deployment_target 10.6 setenv path "/developer/platforms/iphonesimulator.platform/developer/usr/bin:/developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin" /developer/platforms/iphonesimulator.platform/developer/usr/bin/gcc-4.2 -arch i386 -isysroot /developer/platforms/iphonesimulator.platform/developer/sdks/iphonesimulator4.3.sdk -l/users/m...

asp.net - How to forcefully set IE's Compatibility Mode off from the server-side? -

in domain-controlled environment i'm finding compatibility mode triggered on clients (winxp/win7, ie8/ie9) when providing x-ua tags, !doctype definition , "ie=edge" response headers. these clients have "display intranet sites in compatibility view" checkbox ticked. precisely i'm trying override. the following documentation i've used try understand how ie decides trigger compatibility mode. http://msdn.microsoft.com/en-us/library/ff406036%28v=vs.85%29.aspx http://blogs.msdn.com/b/ie/archive/2009/02/16/just-the-facts-recap-of-compatibility-view.aspx site owners always in control of content. site owners can choose use x-ua-compatible tag absolutely declarative how they’d site display , map standards mode pages ie7 standards. use of x-ua-compatible tag overrides compatibility view on client. google "defining document compatibility" , sadly spam engine doesn't let me post more 2 urls. this asp .net web app , includes follo...

video - Is it possible to create an activity under another activity in android? -

i want play video file on full screen , have created activity , put button closing after video finished. but, think if create separate activity each video create storage problem in future. possible create activity inside main activity? my second question is: possible create activity on runtime on demand? also, after finishing work can destroy space allocated object activity? if can in android how? 0% accepted rate? form questions bit better please, have no idea if got right videoviewdemo shows you can change video path, , video shown. mvideoview.setvideopath(path); this done while app running, need 1 activity videos. this how video path between activities: main activity: intent intent = new intent(this, videoactivity.class); bundle b = new bundle(); b.putint("video_url", "your_video_url"); b.putstring("video_name", "teh video"); intent.putextras(b); startactivity(intent); and catch in videoactivity in oncreat...

ruby - How do i access session in lib classes in Rails -

i developing application in rails 3 how access session in lib classes in rails. thanks in rails, applicationcontroller has method named session , use session[:user_id] fetch session value. thus, if want use session in lib, need define method in lib classes access session parameter. lib/your_class.rb class yourclass def set_session(session_) @mysession = session_ end def session return @mysession end end the simple way that, can use module instead of lib class, , include module in controller. can use session[:user_id] in lib module way.

javascript - JS get value of generated textnode -

i have javascript in loop: renderaelements[i] = document.createelement ("a"); renderaelements[i].setattribute("href", "#"); renderaelements[i].setattribute("class", "expander"); renderaelements[i].appendchild(expand); alert (renderaelements[i].nodevalue); where expand created as: var expand = document.createtextnode("+"); the alert, meant return link text of each created element returns null. why this? because trying nodevalue of element node , not text node. alert (renderaelements[i].firstchild.nodevalue);

php - How to send data to another server using jquery -

i need post data server using jquery. here code using $.ajax({ url:"https://www.thewiseagent.com:443/secure/webcontactallfields.asp", type:'post', data:"id=" + $id + "&source=" + $source + "&notifycc=" + $notifycc + "&notifybcc=" + $notifybcc + "&nomail=" + $nomail + "&cfirst=" + $first + "&clast=" + $last + "&phone=" + $phone + "&fax=" + $fax + "&cemail=" + $cemail + "&message=" + $message, success: function() { //window.location.href = "http://www.petlooza.com"; } }); i got error (302 object moved) in case of firefox/chorme although data inserting.. in case of ie data not entering in external database. in ie got access denied error. can have alternative? i have tried json , jsonp still same e...

for loop - How do I implement for-else and foreach-else statement in C#? -

i know not exist, there alternatives? this: for (int = 0; !connected && < 100; i++) { thread.sleep(1); } else throw new connectionerror(); the python construct foreach-else this: foreach( elem in collection ) { if( condition(elem) ) break; } else { dosomething(); } the else executes if break not called during foreach loop a c# equivalent might be: bool found = false; foreach( elem in collection ) { if( condition(elem) ) { found = true; break; } } if( !found ) { dosomething(); } source: the visual c# developer center

iphone - How to keep given password in mgtwitterengine api -

i want keep password given user in variable. password value. in code containing username. using mgtwitterengine api in application. here function printing data on console. -(void)setusername:(nsstring *)newusername password:(nsstring *)newpassword { nslog(@"uset sername %@ , password %@",newusername,newpassword); ... } i debug in function saw function running after loggedin. printing null in password value although username printing well. i have trace tweet value of user. went through mgtwitterengine. there block of code necessary write username , password. here code mgtwitterengine *twitterengine = [[mgtwitterengine alloc] initwithdelegate:self]; [twitterengine setusername:@"username" password:@"password"]; // updates people authenticated user follows. nsstring *connectionid = [twitterengine getfollowedtimelinefor:nil since:nil startingatpage:0]; please me how keep password ? read developer documentation , provides in...

json_decode PHP bugged ? same Json works in other languages -

well json have doesn't work on php json_decode, returns null, , when place exact json in website http://jsonformatter.curiousconcept.com/#jsonformatter says valid , works fine. $json = <<<start {"currentuserscreenname":"tatxtxt","recentplaces":[],"cdnbase":{"versioned":{"ssl":["https:\/\/si0.twimg.com\/a\/1309465578"],"http":["http:\/\/a0.twimg.com\/a\/1309465578","http:\/\/a1.twimg.com\/a\/1309465578","http:\/\/a2.twimg.com\/a\/1309465578","http:\/\/a3.twimg.com\/a\/1309465578"]},"unversioned":{"ssl":["https:\/\/si0.twimg.com"],"http":["http:\/\/a0.twimg.com","http:\/\/a1.twimg.com","http:\/\/a2.twimg.com","http:\/\/a3.twimg.com"]}},"pagelocalejs":"http:\/\/a3.twimg.com\/a\/1309465578\/javascripts\/phoenix\/i18n\/pt.js","becameuser":false,...