Posts

Showing posts from September, 2012

iphone - how to get the nsmutablearray data into float -

iphone - how to get the nsmutablearray data into float - hi getting dataset below webservices *details=[[webservices alloc] init]; [details getmobilenumberdetails:phnotextfield.text]; nslog(@"longitudes arrays %@",details.resultdata); "-91.57696007", "10.343234", "74.982343", "76.464844", "76.464844", but how convert total dataset float help me urgent me in iphone. thanq sir response here if utilize ojectatidex:0 takes first position have store total response single float value without using ojectatidex:0 in iphone. use float x = [[array objectatindex:0] floatvalue]; iphone ios4 nsmutablearray

PHP sessions and security -

PHP sessions and security - i'm trying decide on level of security regards session management on php site. @ top of every page php tag run if (!isset($_session["user"])) {header('location: login.php');} the user session created on login, guys think secure enough? whole site runs in ssl. well, beingness secure has 100's of different topics... in terms of trying achieve, yes think that's fine i add together additional validation checking $_session['user'] definately right user, , seek compare session user's ip address, user agent , other things observe session hi-jacking you should exit; after header("location: x"): header("location: xyz.php"); exit; php

iphone - OpenGL ES 2D - z-ordering, depth buffer vs drawing in order -

iphone - OpenGL ES 2D - z-ordering, depth buffer vs drawing in order - i'm new opengl sorry if it's silly question. no thought if makes difference, in case, i'm using opengl es 1.1. currently i'm drawing sprites in order of texture, i've read it's improve performance (makes sense). i'm wondering whether right approach because need sprites in front end of others regardless of texture. as far i'm aware, options z-ordering either enable depth buffer , utilize that, or switch drawing order sprites drawn in order of z value. i've read depth buffer can performance hit, changing order. should do? the short reply is, sort sprites. it sounds you're creating that's 2d based, , while z-buffer can useful tool, can impressive performance nail if hardware doesn't back upwards it, , if you're not using 3d objects may intersecting 1 another, doesn't create lot of sense me. in addition, if have sprites partially tra...

Using CUDA in Ubuntu 11.10 -

Using CUDA in Ubuntu 11.10 - starting development of cuda-based tools on ubuntu, , tried install/use sdk. however, devicequery gives cuda driver version insufficient cuda runtime version for reference: # nvcc --version nvcc: nvidia (r) cuda compiler driver copyright (c) 2005-2011 nvidia corporation built on tue_oct_18_17:35:10_pdt_2011 cuda compilation tools, release 4.1, v0.2.1221 # cat /proc/driver/nvidia/version nvrm version: nvidia unix x86_64 kernel module 280.13 wed jul 27 16:53:56 pdt 2011 gcc version: gcc version 4.6.1 (ubuntu/linaro 4.6.1-9ubuntu3) i obtain similar errors other tools (namely theano's gpu utilities). the cuda runtime must match driver, i.e kernel module. seem have driver version 280.13 compatible 4.0 runtime. either downgrade runtime or upgrade driver/kernel module: dev driver 4.1 (285.05.32) cuda

javascript - Using jquery in place of watir or selenium for integration tests -

javascript - Using jquery in place of watir or selenium for integration tests - i'm building rails app, , integration tests i'm using cucumber , watir. love cuke, wish had other watir. sure, watir's ok, seems more natural test web page using javascript. love utilize jquery selectors - create sense me. does there exist library supports javascript-based integration tests? maybe node.js? have considered capybara + selenium webdriver? here illustration definition of cucumber step, using capybara , selenium: when /^i take "([^"]*)" scroller bar$/ |arg1| element = page.find(%{div.x-picker-item:contains("#{arg1}")}) element.click step %{i press "done"} end javascript jquery node.js cucumber integration-testing

Sqlite ADO.NET Entity Framework 3.5 ASP.NET MVC Simple Example "Race Condition" -

Sqlite ADO.NET Entity Framework 3.5 ASP.NET MVC Simple Example "Race Condition" - i have simple illustration trying create spike using asp.net mvc 1, sqlite, , ado.net entity framework need portable datastore (db) can run on .net 3.5 i have simple spike working (saving, deleting, modifying records) noticed strange. using extremely simple repository pattern in order manipulate data. if run site shows new record created. noticed if refresh (hold downwards f5 illustration in browser replicate) throw exception below. store update, insert, or delete statement affected unexpected number of rows (0). entities may have been modified or deleted since entities loaded. refresh objectstatemanager entries. i sense concurrency issue way index action saving/deleting records test. how can modify repository can still utilize pattern (which , think clean) yet prevent race condition? went ahead , zipped solution below should work out of box (visual studio 2008) http:/...

sql server - SQL Conditional UPDATE Based on SELECT -

sql server - SQL Conditional UPDATE Based on SELECT - in sql server 2008, have set of info containing costs east , west. i'm adding new field client canada needs 1.5 times east or west cost (which ever greater). i'm trying come sql can execute. i've tried next have not had success: update shippingcost set if eastcost>westcost canada= eastcost*1.8 else canada= westcost*1.8 endif i'm sure there's easy way this? ideas? you need utilize case update shippingcost set canada = case when eastcost>westcost eastcost*1.8 else westcost*1.8 end sql sql-server sql-server-2008 select sql-update

c# - Programmatically authorize a Windows user against a string of users? -

c# - Programmatically authorize a Windows user against a string of users? - programmatically, can authorize windows user based on whether in particular role this: if(!user.identity.isauthenticated) homecoming false; var isauthroized = user.isinrole(@"domain\some role"); // ... homecoming isauthorized; what can't figure out how do, how match user's name if, instance, list of individual users given access. so imagine you're trying authenticate user against given string of authorized users, using normal authorizeattribute: [authorize(users = @"domain\user1, domain\user2, domain\user3")] public actionresult someaction(){ ... } how programmatically authorize user against string of users? @"domain\user1, domain\user2, domain\user3" edit: ok, point of confusion: point of specifying multiple users if have (in normal authorizeattribute) declaration follows: [authorize(users=@"user1,user2,user3", roles=@...

c# - XNA changing blendstate from alpha to Additive -

c# - XNA changing blendstate from alpha to Additive - here's problem using depth command have different sprites need different blendstates how can alter if started spritebatch.begin(...) i trying alter spritebatch.graphicsdevice.blendstate doesn't seems working i cannot turn black area transparency thank you still seems cannot save layer order between them using code... guess problem might in using object.draw(spritebatch) , draw within method. think theres problem because have 2 classes each 1 draw method input spritebatch im doing spritebatch.begin(spritesortmode.fronttoback, blendstate.additive); d.drawattack(gametime, spritebatch); spritebatch.end(); spritebatch.begin(spritesortmode.fronttoback, blendstate.alphablend); drawobjects(gametime, spritebatch); charactersdraw(gametime, spritebatch); // same class d.drawattack spritebatch.end(); both draw layer !between both spritebatche! doesn't seems create difference layerdepth works fine characters ,...

javascript - Auto complete tag like stackoverflow -

javascript - Auto complete tag like stackoverflow - this question has reply here: jquery autocomplete tagging plug-in stackoverflow's input tags? 7 answers what thought behind implementing tagging scheme stackoverflow? question front-end implementation of it. libraries available out there allow me create front-end tagging scheme auto-complete , tag separator 1 stackoverflow/pivotal tracker uses? jquery ui autocomplete start. here example shows multiple selections in single textbox. and here documentation on using multiple values jquery ui autocomplete. i've used autocomplete in several projects variety of purposes, including tagging ui. of course, need handler receive selected values, that's pretty trivial ajax. question front-end implementation, assume have back-end info structures covered. javascript jquery css html5

python - Formatting a spinbutton's display in PyGObject/GTK+3 -

python - Formatting a spinbutton's display in PyGObject/GTK+3 - i'm in process of porting application pygtk pygobject. it's going because did conventional things pygtk. there's 1 ugly hack using display value of spinbutton currency (with $ in front end of it). i got solution the pygtk mailing list in days before stack overflow. can see, magic happens on input , output signals: import gtk, ctypes def _currency_input(spinbutton, gpointer): text = spinbutton.get_text() if text.startswith('$'): text = text[1:] double = ctypes.c_double.from_address(hash(gpointer)) double.value = float(text) homecoming true def _currency_output(spinbutton): text = '$%.*f' % (int(spinbutton.props.digits), spinbutton.props.adjustment.value) spinbutton.set_text(text) homecoming true def format_spinbutton_currency(spinbutton): spinbutton.connect('input', _currency_input) spinbutton.connect('output', _...

automation - How can I get the most out of macros in Notepad++? -

automation - How can I get the most out of macros in Notepad++? - what want similar photoshop's automation feature, can set open file, preform macro, , save file. i prefer if done in notepad++, dreamweaver or other ide have similar? i have couple hundred html files want create repetitive modifications to, , think there easier way doing manually. any help appreciated! if you're open installing cygwin tools sed or awk tools might appropriate kind of repetitive editing. i've used sed prepend license files didn't have explicit license, rename variables, etc. there isn't much hand-holding these tools though -- write little tiny sed or awk programs job: sed -i 's/foo/bar/g' * # replace 'foo' 'bar' in files in current dir macros automation dreamweaver notepad++

Python Global File -

Python Global File - how can write global file within of function? example: output_file=open("output_file_name.txt", "w") def write_to_file: global output_file output_file.write('something') write_to_file() output_file.close() the code above not working. says "valueerror: i/o operation on closed file" ideas? write_to_file function, try def write_to_file(): othrwise code fine python

android - Display Item horizontally? -

android - Display Item horizontally? - all want display image info rss-feed. rss feed code working fine image loading feed, unable display image in horizontal way? tried gallery unable set image that? there way accomplish same? i refer link http://www.dev-smart.com/archives/34 implement horizontal listview in unable implement onclicklistener list. help please. give thanks you. the code tried gallery.. public class imageadapter extends baseadapter { int imagebackground; private list<rssiteam> objects = null; private context context; public imageadapter(context c) { context = c; typedarray ta = obtainstyledattributes(r.styleable.gallery1); imagebackground = ta.getresourceid(r.styleable.gallery1_android_galleryitembackground, 1); ta.recycle(); } public imageadapter(context context, int textviewresourceid, list<rssiteam> objects) { super(); this.context = context; this.objects = objects; } @override public int getcount(...

sql server - T-SQL: How to Select Values in Value List that are NOT IN the Table? -

sql server - T-SQL: How to Select Values in Value List that are NOT IN the Table? - i have list of e-mail addresses, of them in table, of them not. want select e-mails list , whether in table or not. i can users mail service adresses in table this: select u.* users u u.email in ('email1', 'email2', 'email3') but how can select values in list not exist in table? moreover, how can select this: e-mail | status email1 | exist email2 | exist email3 | not exist email4 | exist thanks in advance. for sql server 2008 select email, case when exists(select * users u e.email = u.email) 'exist' else 'not exist' end [status] (values('email1'), ('email2'), ('email3'), ('email4')) e(email) for previous versions can similar derived table union all -ing constants. /*t...

MAGENTO custom options grid -

MAGENTO custom options grid - i have extention - advanced custom options. display related options every products in order/grid. this code use: protected function _preparecollection() { $collection = mage::getresourcemodel('sales/order_grid_collection'); $collection->getselect()->join ( 'sales_flat_order_item', 'sales_flat_order_item.order_id = main_table.entity_id', array ( 'price' => new zend_db_expr('group_concat(sales_flat_order_item.price separator "<br><br><hr>")'), 'proname' => new zend_db_expr('group_concat(sales_flat_order_item.name separator "<br><hr>")'), 'proptions' => new zend_db_expr('group_concat(sales_flat_order_item.product_options separator "<br><hr>")'), ) ); $collection->getselect()->group('main_table.entity_id'); $this->setcollection($collection); homecoming mage_a...

c - Getting a double word from binary data -

c - Getting a double word from binary data - char * info = 0xff000010fffffffffffffffffffffffffff; i want double word in data[1] (0x00000010) , store in var int i . would trick? int = (int) data[1]+data[2]+data[3]+data[4] you attempting add together 4 bytes rather position values right part of integer. without specifying endianness of platform, it's not possible provide final answer. the general approach place each byte in right position of int, this: int = 256 * 256 * 256 * data[0] + 256 * 256 * data[1] + 256 * data[2] + data[3] (big endian example) note indices 0-based, not 1-based in example. "base" in illustration 256 because each byte can represent 256 values. to understand why so, consider decimal number 5234 you can re-write as: 5000 + 200 + 30 + 4 or 10 * 10 * 10 * 5 + 10 * 10 * 2 + 10 * 3 + 4 as process info each digit, multiply value the-number-base-to-the-power-of-the-digit-position (rightmost digit base of o...

php - Something wrong, with my facebook graph URL -

php - Something wrong, with my facebook graph URL - i'm doing wrong when trying access info facebook graph api, here code of page: it fetches need other users email address, understand need extended permissions have requested seen in code below. require 'src/facebook.php'; $app_id = "211665122244023"; $canvas_page = "http://apps.facebook.com/midcitymafia/"; $auth_url = "https://www.facebook.com/dialog/oauth?client_id=" . $app_id . "&redirect_uri=" . urlencode($canvas_page) . "&scope=email,publish_actions"; $signed_request = $_request["signed_request"]; list($encoded_sig, $payload) = explode('.', $signed_request, 2); $data = json_decode(base64_decode(strtr($payload, '-_', '+/')), true); $user_id = $data["user_id"]; if (empty($data["user_id"])) { echo("<script> top.location.href=...

javascript - How to implement history.js with ASP.NET MVC -

javascript - How to implement history.js with ASP.NET MVC - can point me in right direction implementing history.js gist mvc project on @ https://github.com/browserstate/history.js im getting grips mvc , im considering total ajax app ajax nav or standard nav (urls) content loaded via ajax, not sure way go help appreciated. im mvc newbie please forgive me if basic or obvious question if mvc newbie, might utilize library help it. backbone in clean way , supports history through router. javascript jquery model-view-controller browser-history

setup.py - Using 3rd Party Libraries in Python -

setup.py - Using 3rd Party Libraries in Python - i'm writing simple python (2.7) programme using python image library. how can create programme portable, can run in on computer (that doesn't have pil installed). i've looked creating setup.py file, i'm not sure on right track. ok, sounds setup.py right way go here - should have setup() function in it, add together install_requires entry so: setup( name="mypkg", version="0.0.1", # etc etc blah blah blabh install_requires=["pil"], ) that should it! when users run setup.py install, download pil & run pil's own installation routine. python setup.py python-imaging-library

python - How to prevent subprocess.popen to "get lost" in Windows? -

python - How to prevent subprocess.popen to "get lost" in Windows? - i have somehow curious python(3.x) problem: want create timer calls external programme (.exe) @ predefined time - (simplified below, additionally there countdown output): time.sleep(y) x=popen("pathto.exe") if test code works want little y. big y (wait more few hours), python doesnt execute popen command (but there arent errors well). other "normal" code after popen command (for illustration email notification in case) works fine. im not exclusively sure if windows (im working on 64bit windows 7, disabled energy saving features im aware of) or python problem couldnt find solution far: tried several additional arguments popen (shell/no shell, etc.) , tried open program/define x ahead of waiting period , close afterwards 1 time again nil solved unfortunately. many thanks! edit: more detailed code example: while 1: if time.mktime(trade2)<=time.time(): ...

Spring security integration with open id in grails -

Spring security integration with open id in grails - i working on integrating spring security openid grails application using springsecurity core , springsecurity openid plugins. have integrated it, , works need access email logged in person. how can that, able access token used identifying person. thanks ian roberts. gives me reply,which solves problem. his reply was: as happens implemented in 1 of applications yesterday :-) unfortunately it's not open-source app can't point @ code can explain did. the spring-security-openid plugin supports "attribute exchange" mechanism of openid, although back upwards not documented much (if @ all). how works depends on provider @ far end @ to the lowest degree worked me using google , yahoo. in order request email address provider need add together next config.groovy: grails.plugins.springsecurity.openid.registration.requiredattributes.email = "http://axschema.org/contact/email" now wire user...

C++ Class, What's the difference in friend operator vs outside operator -

C++ Class, What's the difference in friend operator vs outside operator - when define operator function within class define within class function not part of class. but same task achived when function outside class , declare friend within class not define it. consider code have 2 identical operator definitions 1 within class ouside class: version 1 (inside of class) class myclass { // version 1 within class friend myclass&& operator +(myclass& a, myclass& b) { homecoming move(myclass(a.x + b.x, a.y + b.y)); } int x,y; public: myclass() {} myclass(int,int){} }; int main() { myclass a, b, c; c = + b; cin.ignore(); homecoming 0; } version 2 (outside of class) class myclass { friend myclass&& operator +(myclass& a, myclass& b); int x,y; public: myclass() {} myclass(int,int){} }; myclass&& operator +(myclass& a, myclass& b) { homecomin...

jquery - Retrieve a small form and place it on an ASP.NET WebForm using AJAX -

jquery - Retrieve a small form and place it on an ASP.NET WebForm using AJAX - i'm looking integrate little form asp.net page pops modal popup not loaded until window pops up. basically, here steps: have pre-existing asp.net form. user clicks button. a modal popup pops (using jquery - popup starts div style set display: none) the popup shown , "please wait" spinning circle thing spins while... an async phone call made server asking simple form. the simple form have textbox , button. controls asp.net controls (obviously run @ server , sent browser in readable html) and, after typing info textbox, force asp.net button , posts back, calls button1_click event , sends contents of textbox server. my question is, can done without using asp.net ajax? can done using jquery or xmlhttprequest, instance, perform on .aspx page or web service, , render contents of page within modal popup? ajax xmlhttprequest makes life easier... , reply yes can done here...

html - CSS Contain input text to 100% width -

html - CSS Contain input text to 100% width - so when set input illustration text box, because has border , padding default, wider 200px. <div style="width:200px; background-color:red;"> <input type="text" name="fname" style="width:100%;"/> </div> i know can forcefulness text box fit within 200px setting class input tag , tagging css -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; is there improve way texbox size correctly, i.e. fill 100% want do? cannot utilize fixed sizes. using css themes text box padding, margins, etc not known @ compile time. can changed out user on fly. solution must work regardless of textbox's padding, border, , margin is. i think have answered own question. box-sizing: border-box; css means of getting element fit within parent. css-tricks goes great detail here. http://css-tricks.com/box-sizing/ i unaware of other css ut...

php - str_replace unexpected behavior -

php - str_replace unexpected behavior - i writing trivial templating scheme running dynamic queries on server. i had next code in templating class: $output = file_get_contents($this->file); foreach ($this->values $key => $value) { $tagtoreplace = "{$key}"; $output = str_replace($tagtoreplace, $value, $output); } i notice strings not beingness replaced expected (the '{}' characters still left in output) . i changed 'offending' line to: $tagtoreplace = '{'."$key".'}'; it worked expected. why alter necessary?. "{" in interpreted string have special significance in php? yes. when using double quotes, "{$key}" , "$key" same. it's done can expand more complex variables, such "my name is: {$user['name']}" . you can utilize single quotes (as have), escape curly brackets - "\{$key\}" - or wrap variable twice: "{{$key}}...

iphone - What is wrong with my UITableView cellForRowAtIndex for Single Selection? -

iphone - What is wrong with my UITableView cellForRowAtIndex for Single Selection? - below code uitableview , when scroll behaves weirdly (too annoying)... problem due reuseidentifier.... dont know how solve.. - (uitableviewcell *)tableview:(uitableview *)tableview1 cellforrowatindexpath:(nsindexpath *)indexpath { static nsstring *cellidentifier = @"cell"; uitableviewcell *cell = [tableview1 dequeuereusablecellwithidentifier:cellidentifier]; nsinteger imgtag = 1; nsinteger lbltag = 2; if (cell == nil) { cell = [[[uitableviewcell alloc] initwithstyle:uitableviewcellstyledefault reuseidentifier:cellidentifier] autorelease]; cell.selectionstyle = uitableviewcellselectionstylenone; uiimageview *imgview = [[uiimageview alloc] initwithframe:cgrectmake(2, 2, 52, 52)]; // image:[uiimage imagenamed:[self.glasstype objectatindex:indexpath.row]]]; imgview.tag = imgtag; [cell.contentview addsubview:imgview]; ...

multithreading - How to assign different methods to different threads in java -

multithreading - How to assign different methods to different threads in java - i know bit threads in 'c' new them in java. if want create 3 threads, 1 addition, sec subtraction , 3rd multiplication can do pthread_t maththread[3]; and while creating each thread can assign them different functions in arguments. void *add(void *arg); void *sub(void *arg); void *mul(void *arg); in java, if implement runnable interface there 1 run() method can use. how implement above? create 3 different runnables: runnable[] runnables = new runnable[] { new runnable() { public void run() { /* add together code here */ } }, new runnable() { public void run() { /* sub code here */ } }, new runnable() { public void run() { /* mul code here */ } }, }; java multithreading

Efficiency in time-series regression in R: How can I do this better? -

Efficiency in time-series regression in R: How can I do this better? - i working on time series, , want check lagged differences significance(and doing dickey-fuller test hand) that's not important. can it, it's mechanical, , there must way more elegantly. or @ to the lowest degree more efficiently. ideas? y <- log.real.gdp.ts delta.y.t <- diff(y,differences=1) lag.y <- lag(y, -1) l1dy <- lag(delta.y.t, k=-1) l2dy <- lag(delta.y.t, k=-2) l3dy <- lag(delta.y.t, k=-3) l4dy <- lag(delta.y.t, k=-4) l5dy <- lag(delta.y.t, k=-5) l6dy <- lag(delta.y.t, k=-6) l7dy <- lag(delta.y.t, k=-7) l8dy <- lag(delta.y.t, k=-8) l9dy <- lag(delta.y.t, k=-9) l10dy <- lag(delta.y.t, k=-10) l11dy <- lag(delta.y.t, k=-11) l12dy <- lag(delta.y.t, k=-12) d = ts.union(delta.y.t, lag.y, l1dy, l2dy, l3dy, l4dy, l5dy, l6dy, l7dy, l8dy, l9dy, l10dy, l11dy, l12dy) ## takes care of na's lm.model.i...

jquery - How to check if dropdown is disabled? -

jquery - How to check if dropdown is disabled? - using jquery how check if read only? this trying.. $("#item").keydown(function (event) { //alert(event.keycode); if (event.keycode == 13) { $("#ok").click(); if ($('#droplength').prop("disabled") == false) { $("#droplength").focus(); return; } if ($('#dropunit').prop("disabled") == false) { $("#dropunit").focus(); return; } $("#qty").focus(); homecoming ; } }); the dropdowns set readonly using jquery also: if ($('#droplength').find('option').length <= 1) { $('#droplength').attr("disabled", "disabled"); } if ($('#dropunit').find('option').length <= 1) { $('#dropunit').attr("disabled",...

javascript - Changing Custom Menu in JQuery Mobile -

javascript - Changing Custom Menu in JQuery Mobile - i'm working jquery mobile. building form includes next code: <label for="genderdropdownlist">gender</label> <select name="genderdropdownlist" id="genderdropdownlist" data-native-menu="false"> <option>unspecified</option> <option value="-1">unspecified</option> <option value="0">male</option> <option value="1">female</option> </select> a custom menu shown here. right now, when clicks drop down, dialog appears multiple options. dialog title says "unspecified". know says because "unspecified" first option. want is, drop downwards default "unspecified" , dialog title "please choose...". i can't seem figure out how this? don't see properties can set accomplish this. thought listening "tap" event, couldn't seem w...

java - Why calling a new thread will not work in AsyncTask's doInbackground()? -

java - Why calling a new thread will not work in AsyncTask's doInbackground()? - while work: new thread(new classimplementingrunnable(stuff, dostuff()).start(); this not: new thread(){ public void run(){ log.i("tag", "i within thread"); dostuff(); } }; no error occurs, ignore , wont start seperate thread, "i within thread" not show. you need phone call start() method on thread inorder create run. new thread(){ @override public void run(){ log.i("tag", "i within thread"); dostuff(); } }.start(); java android multithreading android-asynctask dalvik

ruby on rails - no such file to load -- config/initializers/airbrake (LoadError) -

ruby on rails - no such file to load -- config/initializers/airbrake (LoadError) - i wrote simple ror application , raised exception using airbrake. code follows require 'airbrake' require 'config/initializers/airbrake' begin raise "serious problems happened" params = { :api_key => airbrake.api_key, :error_message => 'notification', :backtrace => caller, :parameters => {}, :session => {} } rescue => e airbrake.notify(:error_class => "special error", :error_message => "spe cial error: #{e.message}", :parameters => params) end when run above code, i'm getting next exception /root/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/cus tom_require.rb:55:in `require': no such file load -- config/initializers/airb rake (loaderror) /root/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1 /rubygems/custom_require.rb:55:in `require' ...

Can't compile with ocaml (ocamlopt) and float -

Can't compile with ocaml (ocamlopt) and float - i have problem compiling ocamlopt , floats i'm under ubuntu 10.04 , ocaml 3.11 for line : let = 10.0;; no worries top level no worries ocamlc (code in test.ml file) : ocamlc -o exec test.ml error ocamlopt : ocamlopt -o exec test.ml message : file "test.ml", line 1, characters 0-1: error: assembler error, input left in file /tmp/camlasm5c3d4d.s where coming ? edit : problem solved, 3.12 fixes bug thank guys :) it looks known issue, , bug appears specific combination of binutils , ocaml should not appear official packages ubuntu 10.04. using official packages? if so, provide exact versions of binutils , ocaml? there patch ocaml in aforementioned bugreport, easier prepare upgrade if can. if using official packages, bugreport should submitted ubuntu bundle fixed. ocaml

sql server - Powershell remotesigned policy not working with SQL agent Job, but working if run "manually" -

sql server - Powershell remotesigned policy not working with SQL agent Job, but working if run "manually" - i have sql 2008 job database backups using powershell script. each step in sql job "operating scheme (cmdexec)" type. each step kicks off powershell script performs sql backup , other things. script lives on remote server, if need create changes, have create them once. if set powershell execution policy "bypass", sql job works. if set "remote signed", fails saying execution policy not set correctly. however, if kick off script cmd window, runs correctly. server 64 bit, have made sure both 32 bit , 64 bit shells have execution policy set "remotesigned". and, have remote server unc path set trusted intranet site in ie (found powershell treats local unc paths http paths, unless set in ie). like said, runs correctly manually kick if off cmd window execution policy set remote signed, , works if sql job kicks if off ...

javascript - How to find out which text field has been used in jquery function -

javascript - How to find out which text field has been used in jquery function - i have next form : <input name="linkcolor" type="text" id="colorpickerfield0" > <input name="linkcolor" type="text" id="colorpickerfield1" > <input name="linkcolor" type="text" id="colorpickerfield2" > in function below, how may find out text field has been invoked. example, want set conditions in onsubmit function if #colorpickerfield0 blah blah, , if #colorpickerfield1 blah blah blah etc etc. help appreciated. thanks $('#colorpickerfield0, #colorpickerfield1, #colorpickerfield2').colorpicker({ onsubmit: function(hsb, hex, rgb, el) { alert($(this)); // if #field0 // statements // if #field1 // statements // if #field2 // statemets $(el).val(hex); $(el).colorpickerhide(); }, onbeforeshow: funct...

c# - Different access to property for different classes -

c# - Different access to property for different classes - i have base of operations (abstract) class component . want command access properties of derived classes such gets read access, write access allowed classes. those 'certain classes' implements abstract base of operations class messagehandler<tmessage> . ideally i'd class implementing imessagehandler able access, think makes requirement bit tougher. this run on xbox , want avoid creating temporary objects (such read-only copies). want minimise number of method calls @ value that's read/written to. the component class , messagehandler<tmessage> classes in own assemblies, both of referenced other projects when using api. i'm guessing i'm going have alter model somehow, can't head around it. public abstract class component { } public class derivedcomponenta : component { int property {get; set;} } public abstract class messagehandler<tmessage> { } public c...

Remove tab ('\t') from string javascript -

Remove tab ('\t') from string javascript - how can remove tab string on javascript? when string comes buffer this: <buffer 0d 0a 3c 25 72 65 73 70 6f 6e 73 65 2e 73 74 61 74 75 73 20...> function translate(data) { var content = data.tostring().split('\r\n'); } and perform following... for example, have these lines: '\t\t var session = request.getsession();' '\t\t session["user"] = {};' and want be: 'var session = request.getsession();' 'session["user"] = {};' by way, when do: content=string(content).replace('\t',''); this why need string(...) constructor. if wont utilize it, sick object has no method replace. assuming content string want parse parses letter meaning this: '\t session' becomes this: 's','e','s','s','i','o','n' why? thanks help! the problem in how defi...

php - JSON get highest to lowest value data multi array -

php - JSON get highest to lowest value data multi array - hello whew im stack in problem.... arranging value highest lowest in json info values pastebin - http://pastebin.com/yjfufdjw codes whew want sort likes highest lowest... whew has solution it? :) pleas help.. :) use 1 of php's sort functions array sorting on array-value of json? php sorting facebook-graph-api multidimensional-array

How bad is to store all background images in CSS? -

How bad is to store all background images in CSS? - i have created layout of website (template). used photoshop design image , sliced create div s. gave me html file including html , css code. separated these in 2 files html , css. background images beingness called within <div id="idname"> tags <img src=... tags. changed this. loaded images in css file idname { background-image: url(url); } all images in site loaded creating background whole. now question is: bad practice? because if leave images within <div> tags wont able set content on top of image. background-image attribute in css file can set content anywhere, not having worry background. no, fine, , may best practice background images. moving image declarations style sheet means images may downloaded little bit later, browsers should have plenty other resources load in meantime, , you'll want prioritize html , stylesheets before background images anyways. just don...

c# - Save Paths, Virtual directories, and static locations -

c# - Save Paths, Virtual directories, and static locations - i had file upload uploading folder in web application root, i.e. had string savepath = @"~/documentation/" string filename = path.getfilename(fileuploadcontrol.filename); fileuploadcontrol.saveas(server.mappath(savepath) + filename); and worked fine, uploading file webapp/documentation/filename.abc the problem is, want alter documentation location don't have move folder when pushing development production. did following in web.config: <appsettings> <add key="documentationlocation" value="c:\documentation\" /> </appsettings> in code: string savepath = configurationsettings.appsettings["documentationlocation"]; string filename = path.getfilename(fileuploadcontrol.filename); fileuploadcontrol.saveas(server.mappath(savepath) + filename); i figured work identically, saving file folder specified in web.config. however, error when seek...

Facebook FQL or graph API events -

Facebook FQL or graph API events - i'm trying develop application wich facebook events , show on iphone application. my question best way retrieve public facebook events in php. know there fql , open graph api fql cannot retrieve public events , can't seem find way this. can help me ? kind regards ! both fql , graph api work well. both great options. fql: fql may faster if want events user's friends. fql has method of getting count of attendees, maybes, not attendings, , "no replies" directly, without having count yourself, saves lots of time when dealing 20,000 people concerts etc. [ if want calculate gender ratios, unfortunately feature wont help much ] fql has method of determining invited whom, called "inviter" "event_member" table, though appears presently broken: finding invited :: facebook fql explorer bug: "inviter":null if using fql, can utilize "privacy" determine if event public. select n...

c - Detecting Endianess -

c - Detecting Endianess - i'm trying create c source code handles i/o whatever endianess of target system. i've selected "little endian" i/o convention, means that, big endian cpu, need convert info while writing or reading. conversion not issue. problem face observe endianess, preferably @ compile time (since cpu not alter endianess in middle of execution...). up now, i've been using : #if __byte_order__ == __order_little_endian__ ... #else ... #endif it's documented gcc pre-defined macro, , visual seems understand too. however, i've received study check fails big_endian systems (powerpc). so, i'm looking foolproof solution, ensures endianess correctly detected, whatever compiler , target system. well, of them @ least... [edit] : of solutions proposed rely on "run-time tests". these tests may evaluated compilers during compilation, , hence cost no real runtime performance. however, branching kind of << if...

c# - Correct way to merge observable sequences for events fired from multiple instances -

c# - Correct way to merge observable sequences for events fired from multiple instances - say have mill method churns out instances of type t, , want rx observable sequence events fired instances originating out of mill method. is using merge() have done below right , optimal way accomplish this? the other way did utilize static event , create observable sequence out of that, don't using static events , curious rx experts think optimal in situation? public t makefoo<t>() t: foo, new() { this.instanceofobservable.merge(new t()); homecoming self; } public class observablesequence : iobservable<eventargs>, idisposable { private iobservable<eventargs> stream; public observablesequence() { } // method called in mill method each new instance of t public void merge(foo instance) { if (this.stream == null) { this.stream = init(instance); } else { io...

algorithm - DEFLATE Decoding -

algorithm - DEFLATE Decoding - i reading deflate method encoding/decoding data. understand process composed of 2 parts: i. replace duplicate info (within specified window) reference previous identical piece. ii. utilize huffman coding cut down size of commonly occurring symbols. i have question regards (i). deflate uses lz77 which, based on size window, searches through info and, if finds duplicate information, replaces "pointer". makes perfect sense. however, when decoding using lz77 how deflate recognize pointer? (pointers length-distance pairs; how can discern if it's pointer or number nowadays in initial data?) reference: http://en.wikipedia.org/wiki/deflate#duplicate_string_elimination it's recommended read deflate rfc 1951 specification, much more precise, , reply such questions. what you'll see in => 3.2.5. compressed blocks (length , distance codes) "the literal , length alphabets merged single alphabet" ...

java - Read response before send it -

java - Read response before send it - i sending plain text file user through servlet. i using flatworm framework build flat file. receive file in browser empty. want start debugging analysing outputstream before beingness sent. how can read response before send in servlet? think same thing asking how can transform outputstream inputstream . i saw solutions involve bytearrayoutputstream , , know when phone call in servlet response.getoutputstream() returns me outputstream , not bytearrayoutputstream . there seems confusion somewhere, though i'm not sure where. what can outputstream? why, can write it, , that's it. means if you're given (or up) output stream, it's supply info - means have it. perhaps on other hand, you're not straight calling write on outputstream yourself, passing stream flatworm library (which in turn write output it). in case, there's debugging "hook" right there - flatworm write out file output stre...

generator - Barcode Help! iOS -

generator - Barcode Help! iOS - i create application allows info retrieved database, , direct iphone application , auto generate barcode out of number stored in database. for example, fellow member a's barcode number(1000001) stored in database , retrieve piece of info database, generate 1000001 barcode in application , reflect on it. whereas fellow member b have barcode number of 1000002. every fellow member has unique set of number. possible me that? if so, how can do? can cocoatouch barcode job? have downloaded project of cocoatouch barcode not know implement at. ios generator barcode

How to create columns in a csv file and insert row under them in python scrapy -

How to create columns in a csv file and insert row under them in python scrapy - please help me in creating columns , inserting rows under them in csv file using python scrapy. need write scraped info 3 columns. first of 3 columns created , info entered in each row. csv comma saparated values format. means text file strings separated commas , line-downs. each line downwards creates row , each comma creates column in row. i guess simplest way create csv file create pythonic dict each key column , value each column list of rows none stands obvious lack of value. can fill in dict appending values requested column (thus adding row) , transform dict csv file iterating on list indexes , each column either add together value, entry in file or , entry index-out-of-bound or none value corresponding list. each row add together line down. python scrapy

ruby on rails - Thinking Sphinx: how to return any attribute when attribute query is blank -

ruby on rails - Thinking Sphinx: how to return any attribute when attribute query is blank - i have search form user can search article content , narrow downwards using select box categories. when category param blank, searches blank id, i'd homecoming category in case. possible configure thinking sphinx accomplish or have include status on controller? article model: class article < activerecord::base belongs_to :category define_index indexes :name indexes content has category(:id), :as => :category_id end ... end searchcontroller: @articles = article.search params[:q], :with => {:category_id => params[:category]} for sphinx, nils/nulls treated 0's, if no params[:category] value passed through controller, it's best if don't pass through filter on attribute. this, perhaps: filters = {} filters[:category_id] = params[:category] if params[:category].present? @articles = article.search params[:q], :with => filters ...

asp.net mvc 3 - How to use NuGet to scaffold to multiple projects in my solution? -

asp.net mvc 3 - How to use NuGet to scaffold to multiple projects in my solution? - i have 3 projects in solution: mvc, domain, dal. if have entity of tasks domain namespace, command line scaffold tasksdbcontext & tasksrepository in dal, tasksarea , taskscontroller in mvc? thanks in advance. to in single command, have build own custom scaffolder scaffold different parts different projects. i found article help me create scaffolder creates files in different projects http://www.jiffnotes.com/2012/04/05/t4scaffoldingacrossprojects.aspx you can create scaffolder based on scaffolders t4scaffolding-nuget. in packages folder in solutionfolder , go "packages\t4scaffolding.1.0.6\tools\efdbcontext" , @ "t4scaffolding.efdbcontext.ps1" file see how works. a great read if need larn basics of working scaffolders steven sanderson creating custom scaffolders. asp.net-mvc-3 nuget nuget-package asp.net-mvc-scaffolding

html - Get data from a form with iframe inside -

html - Get data from a form with iframe inside - i have 1 noob question! in page, have 1 form this: class="lang-none prettyprint-override"> <form method="post" action="buscardadosarvore"> <iframe name="conteudo" id="conteudo" width="100%" frameborder="0" scrolling="auto" height="100%" src="buscaporfamilia.jsp"> </iframe> <input type="submit" value="search!"/> </form> the iframe changes src via javascript when user press 1 button radio... in pages set in ifram src have 1 input type text want recovery in servlet "buscardadosarvore"! but request.getparameter() doesn't work... how can proceed? , sorry english an iframe window browser session. the contents of iframe not within page, hence cann...

MYSQL QUERY replace NULL value in a row with average values -

MYSQL QUERY replace NULL value in a row with average values - i'm using mysql database store huge amount of satellite data, , these datasets has many data-gaps. replace null values 1 hour(or less) average around point. far i've found how replace null value previous known value: update mytable set number = (@n := coalesce(number, @n)) order date; from post: sql query replace null value in row value previous known value my table looks like +---------------------+--------+ | date | p_f | +---------------------+--------+ | 2001-01-01 20:20:00 | 1.88 | | 2001-01-01 20:25:00 | null | | 2001-01-01 20:30:00 | null | | 2001-01-01 20:35:00 | 1.71 | | 2001-01-01 20:40:00 | null | | 2001-01-01 20:45:00 | null | | 2001-01-01 20:50:00 | null | | 2001-01-01 20:55:00 | 1.835 | | 2001-01-01 21:00:00 | 1.918 | | 2001-01-01 21:05:00 | 1.968 | | 2001-01-01 21:10:00 | 2.004 | | 2001-01-01 21:15:00 | 1.924 | | 2001-01-01 21:20:00 | 1....

python - How to duplicate a file but change a few parameters inside? -

python - How to duplicate a file but change a few parameters inside? - i using python interface several fortran files in model. want duplicate fortran file several times @ each copy, alter parameters describe model. for example: have fortran file below !file.f ! fortran code !parameters alpha = 0.5 beta = 100 ... i want re-create file.f several times such have file1.f, file2.f, file3.f, etc. however, @ each file duplicated want alter parameters alpha , beta automatically. thanks edit: allow me explain little further. using python implement info assimilation (kalman filtering) models have been developed in fortran. basically, how works @ each specified time step fortran models stop running, integrate real world info model info , in python. after integration (assimilation), rerun same models time using new parameters obtained fusing info model , observations , new initial conditions. utilize python except run model beingness done fortran. i think cons...

amazon ec2 - What is the easiest way to migrate machine and data from one AWS account to another -

amazon ec2 - What is the easiest way to migrate machine and data from one AWS account to another - i have simple server ebs on 1 amazon account. want migrate other aws account. easiest way this? there tutorial on topic? well can't. that's short answer. can create ami based off server , share other account. amazon-ec2 amazon-web-services amazon-ebs

jquery - Easiest Path or Toolkit toward Ubiquitous Site Login Capability? -

jquery - Easiest Path or Toolkit toward Ubiquitous Site Login Capability? - i've plugged in facebook integration "log in facebook" button. works fine, i'm wondering if there's toolkit or known path of to the lowest degree resistance moving toward "log in ..." (google, liveid, twitter, or whatever). using asp.net mvc (c#) on end , jquery on front end end. i'd love if there 1 toolkit plugged in functionality without reinventing 1 @ time. thanks! jquery authentication openid windows-live-id

windows phone 7 - Making custom Gallery View for wp7 -

windows phone 7 - Making custom Gallery View for wp7 - i ma newbie wp7 (and dot net). have thumbnails in application, on clicked want show them open in detail. there default image viewer available in wp7, trying create 1 own (with next, previous , pinch zoom). trying follow this have no thought of how bind image pivot control... please help. thanks!!! check out: wp7: binding element outside pivot.itemtemplate though should consider showing 3 images in pivot control, , when turning page in command should remove lastly item, , add together 1 new. have this, because not recomended utilize pivot command displaying more 9 items. windows-phone-7

silverlight - How to enable a child control of the disabled parent? -

silverlight - How to enable a child control of the disabled parent? - i'm wondering if it's possible create kid command enabled if parent disabled in silverlight? no. can set isenabled = true; never anabled because parent no enabled silverlight

content management system - How to make a CMS config file in PHP (custom) -

content management system - How to make a CMS config file in PHP (custom) - i making custom cms in php , want know best way create config file it. want can alter variables within admin panel going add. have not messed filesystem functions before or other file functions not sure best approach. thanks! an .ini file can structured quite , you'll able update sections of. compared straight php configuration can edited easier syntax. to parse .ini file php array, utilize function parse_ini_file() php content-management-system

profiling - Is it possible to profile a Haskell program without prof libraries? -

profiling - Is it possible to profile a Haskell program without prof libraries? - is possible time profile haskell programme without installing profiling libraries? when pass -prof alternative ghc, errors one: src/mypkg/fooblah.lhs:7:7: not find module `data.time.calendar': perhaps haven't installed profiling libraries bundle `time-1.1.4'? utilize -v see list of files searched for. i know solution install cabal profile versions of libraries, pain in ass (sorry bad language). i think should possible profile programme , calls have no symbols should appear ???? or in output. no, it's not possible. building profiling changes representation , function calls have parameters maintain track of profiling data. you have install profiling libraries utilize ghc's profiler, if it's pain in rear. haskell profiling ghc

persistence - How to correctly model loosely-typed properties in RavenDB -

persistence - How to correctly model loosely-typed properties in RavenDB - i new ravendb , looking guidance on right way store loosely-typed data. have type list of key/value pairs. type of value property isn't known @ design time. public class descriptivevalue { public string key { get; set; } public object value { get; set; } } when query descriptivevalue saved datetime or guid value, deserialized info type string. numeric values appear retain info types. is there elegant solution retain info type or should store values strings? if go string route, limit me when later want sort , filter info (likely via indexes?) i hoping mutual problem solved , i'm thinking problem incorrectly. help much appreciated! update: output of unit test is: assert.areequal failed. expected:<2/2/2012 10:00:01 (system.datetime)>. actual:<2012-02-02t10:00:01.9047999 (system.string)>. [testmethod] public void store_withdatetime_ispersistedcorrectly() { ...

jquery - Other way to "wait" during javascript animation -

jquery - Other way to "wait" during javascript animation - i'm looking way execute code : $.each($("#gallery > img"), function(index,curimg) { settimeout(function() { clearcanvas(); cvsctx.drawimage(curimg,0,0); } , index*animationms); }); this code draw image gallery canvas every animationms . create possible stop animation, "play/stop" button, can't way... thought or workaround ?? give thanks !! i find creating timeouts in loop hard manage - don't want have cancel multiple timeouts. improve have function doing work phone call (indirectly) setting timeout before completes, because can set in simple if test decide whether set next timeout , go on animation. perhaps little this: <input id="playpause" type="button" value="play"> <script> function initanimation(animationms, autorepeat, waitforplaybutton) { var current...

android - Hybrid vs Native Mobile app -

android - Hybrid vs Native Mobile app - i need create mobile app ios , android (so 2 apps). app utilize native mobile functionality, , lot of functionality related displaying static/ dynamic information. planning move info on web app , embed web pages (html5) in mobile apps (basically phone call urls , display info). is mutual way of developing mobile apps? or there can issues next hybrid approach? there advantages of native app on hybrid app (or vice versa) thanks kamal i've done native android development, i've helped debug few apps created using "cross-compile" platforms such phonegap , cross-compiled apps have few quirks it's nice allow platform handle if build native app. for example, 1 of ones debugged lately didn't implement handlers button events, uncomfortable user experience. in native android app, , assume same ios although i've never tried building ios, scheme handles button presses you, because knows activity running...

javascript - Tracking changes in web application -

javascript - Tracking changes in web application - i have application in user needs see changes have been made during latest edit. changes mean, changes made in inputs textarea, dropdowns. i trying implement showing background image on right top , when user clicks background image, popup shown shows difference. using prototype 1.7.0. my first question be:- 1. best approach implement functionality? 2. can set onclick on background image? there functions in jquery library believe helpful you. if using prototype, guess there similar functionality may utilize. i suggest writing code this: var $input = $('input').add('textarea').add('select'); $input.each(function() { var id = $(this).attr('id'); var value = $(this).val(); var hiddenid = 'hidden' + id; var newhiddeninput = $("<input type='hidden'").val(value).attr('id',hiddenid); $(this).after(newhiddeninput); }); the above code c...

javascript - Chrome Extension Help: Trigger variable CSS from popup.html -

javascript - Chrome Extension Help: Trigger variable CSS from popup.html - okay, i'm building extension so: has browseraction invokes popup.html has input field, submit button, , link invokes javascript action a background.html page receives input value info via popup.html , uses them inject custom css page i'm using localstorage store input info future use. here's need help with: run javascript in background.html (which injects css) when button clicked in popup.html passing along info input field in popup.html background.html i scoured google source code not find anything. i'm not looking inject css every page (i know how that) or when browser action icon clicked (i know how well). need css injected when user inputs info popup.html , clicks on link or button. updated: i'm still not able need this. here's code: <script type="text/javascript"> var bgrsize = localstorage.getitem('gridsize'); function inse...

c++ - gcc deep/double/nested casting -

c++ - gcc deep/double/nested casting - first code #include <stdio.h> typedef wchar_t* bstr; wchar_t hello[] = l"hello"; class _bstr_t { public: operator const wchar_t*() const throw() { homecoming hello; } operator wchar_t*() const throw() { homecoming hello; } }; class container { public: operator _bstr_t() { homecoming _bstr_t(); } }; int main() { // gives error (with gcc 4.5.2 @ least): // test.cpp:20:27: error: cannot convert "container" "wchar_t*" in initialization wchar_t *str = container(); printf("%s\n", str); homecoming 0; } the problem here container() can casted _bstr_t , wchar_t* , but, gcc not. the problem can solved using manual cast: wchar_t *str = (_bstr_t)container(); but need avoid manual cast, gcc figure out automatically. why need because returned container type objects used in calls like void func(wchar_t* str); func(myobject->container); where don...