Posts

Showing posts from August, 2010

Is there a way to tell meteor a collection is static (will never change)? -

on meteor project users can post events , have choose (via autocomplete) in city take place. have full list of french cities , never updated. i want use collection , publish-subscribes based on input of autocomplete because don't want client download full database (5mb). there way, performance, tell meteor collection "static"? or make no difference? could suggest different approach? when "want tell server collection static", aware of 2 potential optimizations: don't observe database using live query because data never change don't store results of query in merge box because doesn't need tracked , compared other data (saving memory , cpu) (1) can rather constructing own publish cursor. however, if client observing same query, believe meteor (at least in future) optimize it's still 1 live query number of clients. (2), not aware of straightforward way because potentially mess data merging on multiple publications , subscript...

PayPal Integration and Sandbox Test Account Android -

Image
i developing android app in have integrate paypal.i have followed mpl paypal tutorial integrate palpal in app.i understood clearly.but problem i unable make personal , business test account because when make account ask me account details. i living in non-usa country. i follow sandbox testaccount make account. problem nob 1. says when go paypal.com make test account then problem nob 2. my country not in list of " your country or region " problem nob 3. when go make individual test account ask me credit card information if ignore credit card information @ point @ next step have add it. from start go https://developer.paypal.com/ create new developer account , log in there can create sandbox account have 2 options personal or bussiness account. when create personal account automatic credit card added paypal login. by using login details can test application.

compiler construction - Why it is important to first convert code in assembly? -

while learning reverse engineering, got know assembly best way see , attack closed source software. why languages c/c++ needs convert code assembly, why doesn't directly convert machine language. secondly why necessary map code sections (like .stack,.bss) @ same location (virtual) every time? some compilers, in time compilers example, output machine code. in general easier debug compiler human examining assembly language rather machine code. extent "unix way" adding layer existing tools, etc. in case assembler , linker need exist target platform, understood argument. can generate assembly language , debug visually, , use existing assembler , linker turn usable machine code.

How can I write into a particular line of a file in a bash script? -

i want write data taken file last line (not in new line) of file. using following script. #!/bin/bash echo "write start , end file number:" read sta end echo "$sta" "$end" (( c="$sta"; c<="$end"; c++ )) cp analyzeclusterparameterfile analyzeclusterparameterfile$c awk '{if (nr== '$c' -10){print $1 " " $2 " " $3}}' center.dat >> analyzeclusterparameterfile$c done but (analyzeclusterparameterfile$c file) going new line this rinner = 0.1 ! in mpc router = 5 ! in mpc numberofpoints = 50 ! default 16 virialdensity = 200 ! default 200 centerlistname = 5.044627347e-01 5.008533222e-01 5.043365095e-01 what want(analyzeclusterparameterfile$c file) rinner = 0.1 ! in mpc router = 5 ! in mpc numberofpoints = 50 ! default 16 virialdensity = 200 ! default 200 ...

singleton - how to initialize static class at service level in wcf -

i have singleton log framework, can suggest how initialize @ service level. have attach event handlers part of initialization. when had initialized in service class getting executed(handlers added) each client call , therefore log table getting updated multiple times same records. thanks.. if want control how service instance gets initialized, you'll need implement custom service host. msdn article should give start. idea put log framework initialization in service host occurs once , have injected each service instance.

javascript - Removing Cookie value from browser -

i know has been asked many times, , ive tried using accepted answers. sadly none of seems work me in browser(mozilla v18.0.2). i using backbone website , im using cookies handle user login sessions. the following unsuccessful ones : code 1 var cookie_date = new date ( ); // cookie_date.settime ( cookie_date.gettime() - 1 ); // 1 second before now. // empty cookie's value , set expiry date time in past. document.cookie = "uid=;expires=" + cookie_date.togmtstring(); document.cookie = "username=;expires=" + cookie_date.togmtstring(); code 2 var nameeq = name + "="; var ca = document.cookie.split(';'); for(var i=0;i < ca.length;i++) { var c = ca[i]; while (c.charat(0)==' ') c = c.substring(1,c.length); if (c.indexof(nameeq) == 0){ uid = c.substring(nameeq.length,c.length); return uid; } }; any working solution removing browser cookies?? thanks roy ...

mysql - Query on large i18n table slow in CakePHP -

the query below, using cakephp's i18n table, takes around 1000ms run. i18n table large - has around 600,000 rows. have default indexes on table, per cake schema. how can speed queries up? caching them possible when cache needs cleared these queries run, , slow down performance quite noticeably. select `category`.`id`, `category`.`slug`, `category`.`name`, `category`.`description`, `category`.`head_title`, `category`.`display_title`, `category`.`category_count`, `category`.`product_count`, `category`.`parent_id`, `category`.`lft`, `category`.`rght`, `category`.`sort_order`, `category`.`created`, `category`.`modified`, `category`.`image_processed`, ((rght - lft) = 1) `category__is_child`, (`i18n__name`.`content`) `category__i18n_name`, (`i18n__description`.`content`) `category__i18n_description`, (`i18n__slug`.`content`) `category__i18n_slug`, (`i18n__head_title`.`content`) `category__i18n_head_title`, (`i18n__meta_description`.`content`) `category__i18n_meta_description`,...

c# - filtering the joint which we want to draw -

i playing kinect , want have control drawing every part of human body. make combo box'es : invisible left arm, invisible right arm, ... and i've connected drawbone method , work. now, try filtering joints lays on invisible bones make them invisible too, have code : foreach (joint joint in skeleton.joints) { brush drawbrush= null; if (joint.trackingstate == jointtrackingstate.tracked) { drawbrush = brushes.black; } else if (joint.trackingstate == jointtrackingstate.inferred){ drawbrush = new solidcolorbrush(color.blue); } if (drawbrush != null) { drawingcontext.drawellipse(drawbrush, null, this.skeletonpoint(joint.position), 20, 20); } } i've tryied position if (joint.position == jointtype.shoulderleft) { return; } but error i'm trying compare in way ...

java - Servlet init and Class -

i have programm servlet : @webservlet("/controler") public class controler extends httpservlet { } i need use property file : file.properties in program. load it, have class : public class proploader { private final static string m_propertyfilename = "file.properties"; public static string getproperty(string a_key){ string l_value = ""; properties l_properties = new properties(); fileinputstream l_input; try { l_input = new fileinputstream(m_propertyfilename); // file not found exception l_properties.load(l_input); l_value = l_properties.getproperty(a_key); l_input.close(); } catch (exception e) { e.printstacktrace(); } return l_value; } } my property file in webcontent folder, , can access : string path = getservletcontext().getrealpath("/file.properties"); but can't call theses methods i...

.htaccess — Variable location of affected folder -

i have php script generate placeholder images, placehold.it service. wanted custom 1 prevent latency occurs free online services. i have included script inside of folder ./assets/placeholder/ in personal front-end boilerplate. why need .htaccess adapts current location of placeholder folder, not root. the script takes following parameters: d (dimension, eg. 400, 250x100), bg (background color), color (text color) , text . ideally, url work following ./assets/placeholder/300x200/eaeaea/333333?text=test , text being regular var. here .htaccess put while ago. works provided file in root directory: rewriteengine on rewriterule ^#([^/]*)/([^/]*)/([^/]*)$ index.php?d=$1&bg=$2&color=$3 [qsa] in 1 sentence, if move file (index.php) root /some/other/dir/index.php, want .htaccess file still function without have change rewritebase or anything. i have found this article on matter , don't have enough knowledge on subject make fit case. thanks in advance! upda...

c++ - GCC 4.7.2 on Debian amd64 - built-in atomic increment? -

my test source is: volatile int gl = 0; void * internalhandler( void * param ) { ( int = 0; < 100000; ++i ) { ++gl; } return 0; } int main() { pthread_t ths[100] = { 0 }; ( int = 0; < 100; ++i) { pthread_create( &ths[ ], 0, internalhandler, 0 ); } ( int = 0; < 100; ++i) { pthread_join( ths[ ], 0 ); } std::cout << gl << std::endl; return 0; } when compile , run code on debian (via virtualbox), 10000000 every time, while has race condition. uname -a: linux debian-dev 3.2.0-4-amd64 #1 smp debian 3.2.46-1 x86_64 gnu/linux gcc -v: using built-in specs. collect_gcc=gcc collect_lto_wrapper=/usr/lib/gcc/x86_64-linux-gnu/4.7/lto-wrapper target: x86_64-linux-gnu configured with: ../src/configure -v --with-pkgversion='debian 4.7.2-5' --with-bugurl=file:///usr/share/doc/gcc-4.7/readme.bugs --enable-languages=c,c++,go,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.7 --enable-shared --enable-linker-build-id --wi...

cross browser - CSS display:inline/none with tables works with Firefox but not Chrome or Safari -

i working on quick , dirty application involves several single-column tables displayed horizontally within outer table. |-------------------------------------------| | outer table | |-------------------------------------------| | --------- --------- --------- | | | table 1| |table 2| |table 3| | | --------- --------- --------- | | | row 1 | | row 1 | | row 1 | | | --------- --------- --------- | | ... | | --------- --------- --------- | | | row n | | row n | | row n | | | --------- --------- --------- | | | |-------------------------------------------| --------- --------- |show #2| |show #3| --------- --------- i realize done using css without tables, not adept enough , doesn't need elegant. @ start, first table displayed. clickin...

cakephp - Working with hasMany and Multi-select -

scenario i have provider , package . a provider can have number of featured packages. so need habtm between provider , package i want save providers featured packages in 1 shot using provider::edit() method setup have 3 models. provider featuredpackage package models these setup using ' habtm through ', should not confused habtm. relationships follows. provider hasmany featuredpackage featuredpackage belongsto provider package hasmany featuredpackage featuredpackage belongsto package controller public function admin_edit($id) { if ($this->request->is('post') || $this->request->is('put')) { if ($this->provider->saveall($this->request->data)) { // snip view echo $this->form->input('featuredpackages', array('type' => 'select', 'multiple' => true, 'options' => $packages)); the issue i'm not sure how save multiple vari...

objective c - JSON to NSMutableArray with AFNetworking -

This summary is not available. Please click here to view the post.

Firefox SVG shape not printing when it has stroke -

Image
i having issue svg shapes have stroke , trying them print in firefox. this simplest example: <svg xmlns="http://www.w3.org/2000/svg" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink"> <rect x="0" y="0" rx="15" ry="15" width="300" height="400" style="stroke:black;stroke-width:5;" fill="black" /> <circle id="firstcircle" cx="50" cy="50" r="30" stroke="black" stroke-width="2" fill="white" style="opacity:0.75;"/> <circle id="secondcircle" cx="50" cy="150" r="30" fill="white" style="opacity:0.75;"/> </svg> when try , print first shape 1 of 2 things: it not show @ all it shows off center in bounding box. the second shape no stroke shows expected, expected. when displaying on scre...

encryption - For a public key cryptography, from where this prime numbers are generated -

for public key cryptography , prime numbers generated , there predefined list pick numbers or what, in rsa, dsa, diffie-hellman key agreement etc.? searched lot on internet. hope me out in easy way. there no predefined list. candidates generated randomly , tested primeness.

ssh - Once SSHd into my windows laptop, Putty doesn't recognize python -

i'm sshing mac windows laptop has putty on it. can ssh in fine, , seems work, except python. when type in 'python myfile.py' error "-bash: python: command not found" if i'm in terminal window colorful putty, , if type in "cmd" switch command window, error "'python' not recognized internal or external command, operable program or batch file." have gotten python work on windows computer when not ssh'ed it. so, have put python27 environment variables. i have found if type in "/cygdrive/c/python27/python.exe myfile.py", run, able type in "python". know how fix this? figured out. found link: http://cs.nyu.edu/~yap/prog/cygwin/faqs.html#bashrc helped. went /usr/bin folder, typed ln -s /cygdrive/c/python27/python.exe and can type "python myfile.py" when ssh'd through putty , works!

bash - Redirect stdin to stdout while waiting for background process -

i have following code: cmd cmd_args & wait_pid=$! trap "kill -s sigterm $wait_pid" sigterm sigint sigkill wait $wait_pid with want able kill background process whenever tries kill script. however, still want stdin redirected background process, not happening. i grab wait's stdin , redirect background process. that, i've tried: wait $wait_pid 0>&1 1> named_pipe but without luck. as mentioned, can't trap sigkill (or sigstop ). other that, try this: #!/bin/bash cmd cmd_args <&0 & wait_pid=$! trap "kill -s sigterm $wait_pid" sigterm sigint wait $wait_pid the <&0 tell bash want cmd 's stdin script's stdin. slightly off topic, interesting method of dumping bytes running process' stdin send them directly it's /proc file descriptor, in: echo "stuff send process" >/proc/$wait_pid/fd/0

Android switch between Login and MainActivity -

i have 2 activities. mainactivity public class mainactivity extends sherlockfragmentactivity{ private sharedpreferences settings; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); settings = getpreferences(0); if (settings.getboolean("firststart", true)) { intent = new intent(getapplicationcontext(), loginactivity.class); startactivity(i); finish(); } } } loginactivity called @ first time app starting. calls saveclass() method: private void saveclass() { sharedpreferences preferences = getpreferences(0); sharedpreferences.editor editor = preferences.edit(); editor.putboolean("firststart", false); editor.commit(); toast.maketext(loginactivity.this, r.string.toast_login_success, toast.length_short).show(); intent = new intent(getapplicationcontext(), mainactivity.class)...

Android BlutoothChat, making class instance available across other activities -

i'm messing around 1 of android samples bluetooth chat, im relatively new android i'm here users opinions, in main activity class , instance of class "bluetoothchatservice mchatservice" created controlling of bluetooth connectivity, have created new activity launches page of buttons, these buttons send hardcoded messages depending on 1 pressed, aseen "mchatservice" has been initiated , handling connection make class instance available in newly created activity can send messages straight away, what best practices make available?, have read serializing class (which wont work in instance) can pass in intent, , singletons? can advice way should done? thanks! if can't make class serializable use parcelable , intent.putextra() when sending , intent.getextras().getparelable() on receiving end. passing reference bluetooth class might tricky. better handling message sending in original activity.

python - Dajaxice function not callable error after initial setup -

i set django , dajaxice , having trouble getting work after closely checking documentation both django set , dajaxice. after research here @ stack overflow thing found make sure had dajaxice_autodiscover() in urls.py, do. here ajax.py in timeblendapp: from django.utils import simplejson dajaxice.decorators import dajaxice_register @dajaxice_register def sayhello(request): return simplejson.dumps({'message':'hello world'}) and html page {% load dajaxice_templatetags %} <html> <head> <script type="text/javascript"> function my_js_callback(data){ alert(data.message); } </script> <title>my base template</title> {% dajaxice_js_import %} </head> <body> <button onclick="dajaxice.timeblendapp.sayhello(my_js_callback);">click me</button> </body> </html> the error is functionnotcallableerror @ /dajaxice/timeblendapp.s...

Please help me with think of a better algorithm in Ruby on Rails -

i have events, people. there many-to-many relationship between them there personevent connecting events people. event has date , type personevent has event_id , person_id person has name i'm trying build search form allows user search type of event, , returns list of people attended event of type in past , last date attended such event. should in controller. the solution can think of involves nested loops , run slowly. i'm looping through lot of things don't need be. for each person in person.all each personevent in personevent.all add personevent array if person_event.event.type correct now, loop through array , find event latest date. that's date of last event attendance. can suggest better algorithm? as have associations set should able like: f = person.joins(:events) f = f.where(:events => { :type => "the_type_you_are_searching_for" }) f = f.group('people.id') f = f.select('people.*, max(events...

html - clear float in the same element -

i have p.test given width , float:left. div takes half of full width. so, if create next element after p.test, go same line p.test. using p instead of div, because related tinymce staff , in scenario divs cannot use. i want write css rule: "everything goes after p.test start on next line if p.test doesn't take 100% of width , floating left". it related clearing float, problem cannot use container or add clear:both after p.test in html layout (again - because tinymce editor used). need purely css solution done "p.test" element or "element next p.test whatever is". maybe there other, not sure. <p class="test"></p> <p>element should on next line whatever is</p> .test { width: 60%; float: left; } you put clear: left on first element don't want bubble beside floated element. .test + * { clear: left; } or … since has fixed width, don't float .test in first place.

ios - "Undefined symbols for architecture" clang error (using static library) while the symbol definition is present -

i developing open-source ios static library demo project. created "library" xcodeproj, created class dknavigationbar , included had include it. created "demo" xcodeproj , dragged "library" xcodeproj it. included static library in "target dependencies" section , imported library in pch file using #import <mylibrary/mylibrary.h> . built demo project , there no errors @ all. then, in dkdappdelegate.m called [dknavigationbar class] - lldb gave me no error. built project , boom: undefined symbols architecture i386: "_objc_class_$_dknavigationbar", referenced from: objc-class-ref in dkdappdelegate.o ld: symbol(s) not found architecture i386 clang: error: linker command failed exit code 1 (use -v see invocation) at first glance, seems normal mistake: "oh, forgot add source file 'compile sources' build phase". when looked deeper , deeper realized set correctly. after research realized symbol definition ...

intuit partner platform - API for Viewing Payroll Data -

new ipp. wondering if there method view payroll data. in tinkering api explorer, see there payrollitem api promising description, when try 'retrieve all', returns payroll categories 'salary', 'overtime', etc... want pull payroll information employee specific time period. possible , if so, how? thanks you can use filter endpoint of payrollitem entity. date filter available(all filter attributes documented in following link). https://developer.intuit.com/docs/0025_quickbooksapi/0050_data_services/v2/0500_quickbooks_windows/0600_object_reference/payrollitem#retrieving_payrollitems_using_a_query_filter it not possible filter customerid in v2. if answers question, plz feel free accept answer thanks

python - Use Pandas' NaNs to filter out holes in time series -

i having bit of trouble filtering data pandas nas. have data frame looking this: jan feb mar apr may june 0 0.349143 0.249041 0.244352 nan 0.425336 nan 1 0.530616 0.816829 nan 0.212282 0.099364 nan 2 0.713001 0.073601 0.242077 0.553908 nan nan 3 0.245295 0.007016 0.444352 0.515705 0.497119 nan 4 0.195662 0.007249 nan 0.852287 nan nan and need filter out rows have "holes". think of rows time series, , hole mean nas in middle of series, not @ end. i.e. in data frame above, lines 0, 1 , 4 have holes, 2 , 3 not (having nas @ end of row). the way think of far this: for rowindex, row in df.iterrows(): # step through each entry in row # , after encountering first na, # check if subsequent values na too. but hoping there might less convoluted , more efficient way it. thanks, anne as say, looping (iterrows) last resort. try this, uses apply axis=1 instead of ...

matlab - Hist3 Plotting and Axes Range -

Image
i'm plotting 3-d histogram matlab , it's working pretty ok, except different axes ranges. i'd them defined in way, equal value pairs lie on bisecting line. my code looks (more or less "stolen" hist3 matlab example): [vec_voxel_ids, vec_dose_values_reference, vec_dose_values_control] = ... textread('_boostint_voxel_data.txt', '%u %u %u'); mat_dose_values = [vec_dose_values_reference, vec_dose_values_control]; hist3(mat_dose_values, [100, 100]); xlabel('dose reference'); ylabel('dose control'); set(gcf, 'renderer', 'opengl'); set(get(gca,'child'), 'facecolor', 'interp', 'cdatamode', 'auto'); this how looks: in order reposition bins align centers ticks , choose range of bin values can use hist3 's 'edges' option (similar in histc ): data = 500+5*randn(1e3,2); % dummy data d = 1; % width x , y bins x = 4...

yii - Specifying Access Rules Specific Error Message In Controller -

i using yii 1.1.10 version in trying specify rules specific error message defining message in accessrules function specified below: public function accessrules() { return array( array('allow', // allow users perform 'index' , 'view' actions 'actions'=>array('xxx','yyy'), 'users'=>array('*'), ), array('allow', // allow users perform 'index' , 'view' actions 'message'=>'you must logged in member perform action.', 'actions'=>array('zzz','aaa',), 'expression'=>'authenticationhelper::issessionuseradmin()', ), array('deny', // deny users 'users'=>array('*'), 'message' => "this generic message.", ), ); } however in case expression fails, able v...

java - spring security authorization only -

i trying develop user management tool using waffle perform windows authentication spring security. unfortunately, thing provides me authentication part. i assign role particular user session in order limit users privileges. each username stored in database along associated role. how can spring security query database , load associated role session, can use @preauthorize(hasrole(role)) annotation in controller restrict access actions? edit: answer don't think thats quite looking for. have made progress(i think). authentication provider have created own custom grantedauthorityfactory property of wafflespringauthenticationprovider follows: <bean id="wafflespringauthenticationprovider" class="waffle.spring.windowsauthenticationprovider"> <property name="allowguestlogin" value="false" /> <property name="principalformat" value="fqn" /> <property name="roleformat" value="...

mysql - Getting the number of connect data while skipping the duplicates -

ok, im sure im going minus sipmly cannot find solution. have table goes this: date | name ------------- 1 peter 2 | peter 3 | peter 3 | peter 4 | peter and when query: select distinct count(date) day name 'peter' it comes out " 5 " instead of "4" i tried couple of options , cannot number of times of same name being mentioned in same date while skipping duplicates. lot in advance! you there, misplaced distinct keyword. way placed mysql select distinct counts rather distinct dates. try placing so: select count(distinct date) day name 'peter' this way mysql distinct dates, intended.

asp.net - Button onclick event in VB -

i'm trying build cell within table . cell going button should open hyperlink(an email address) .how write onclick event below code in vb cell i'm building newcell = new tablecell newcell.id = "celrptselect" & rptrow & "f" newcell.style("width") = rowrptselectheadf.style("width") newcell.cssclass = "tablebutton" newcell.text = "sme" newcell.attributes.add("onclick", "rpt.smeemail") newcell.attributes.add("runat", "server") newrow.cells.add(newcell) rpt.smeemail data i'm getting database thanks in advance you can use code newcell.attributes.add( "onclick", "cellaction( me )" ); add script <script type="text/vbscript"> sub cellaction( tdcontrol ) msgbox tdcontrol.id end sub </script>

regex - Javascript regular expression to find double quotes between certain characters -

i'm trying create string can parsed json. string dynamically created based on content in cms. content contain html markup double quotes, confuses json parser. so, need replace double quotes in html &quot; without replacing double quotes part of json structure. idea wrap the html inside markers, use identify between these markers quotes want replace. instance string want parse json this... str = '{"key1":"xxx<div id="divid"></div>yyy", "key2":"xxx<div id="divid"></div>yyy"}'; so, want replace every double quote between xxx , yyy &quot; . like... str = str.replace(/xxx(")yyy/g, '&quot;'); hope made sense. suggestions. given stack overflow's "we don't homework" principles, don't think i'm going work through whole solution, can give pointers in half-finished code. var xysearch = /this regex should find text between xxx.....

javascript - Highcharts columnchart: How to separate overlapping columns -

i using highcharts plot data points in column chart. x-axis datetimestamped , y-axis simple numeric frequency. two of datapoints overlapping. want them shown separate columns on chart. want x-axis show month 'year. my javascript below: $(function () { $('#container').highcharts({ chart: { type: 'column' }, xaxis: { type:'datetime', datetimelabelformats: { month: '%b \'%y' }, tickinterval: 24 * 3600 * 1000 * 30 }, yaxis: { min: 0, title: { text: 'frequency' } }, plotoptions: { column: { pointpadding: 0.2, pointwidth: 10 } }, series: [{"name":"warning","data":[{"x":1367391600000,"y":1}]},{"name":"pass","data...

java - JavaFX: Toolbar with imagebuttons -

how can create toolbar this: link: http://s14.postimg.org/99095jk3l/image.png i created toolbar correct background. problem buttons. dont know how style buttons transparant, , how add correct on hover , on click effects match background. thanks in advance you'll working css. can set background , border transparent , have hover class adding semi-transparent border. end being (please note, may have make tweaks still) .button { -fx-background-color: transparent, transparent, transparent, transparent; } .button:hover{ -fx-background-color: transparent, rgba(0,0,0,.1), rgba(0,0,0,.1), transparent; } .button:armed { -fx-background-color: transparent, rgba(0,0,0,.1), rgba(0,0,0,.1), rgba(0,0,0,.2); } to apply style sheet you'd use code similar this: toolbar.getstylesheets().add("filename.css"); there lots of references in "info" section of "javafx-2" tag. here few should prove helpful this: javafx 2 css refer...

session - Co-located caching for web roles during VIP swap -

when using co-located caching, happens during vip swap? i image session state cleared (or @ least extent?) that correct. if storing session state in either colocated or dedicated cache , swapping new deployment production slot, cache , of session data in it, cleared , lost. consider using shared cache or storing session data in storage/sqlazure if behaviour not desirable.

sql server 2008 - Trigger update and handle null values -

i have trigger takes old values orginal tabel , put these values in 1 cell on table except date , user, when updates occurs, orginal table has attributes null when raw inserted (updatedate , updateuser), when raw updated 2 attributes update current date , user did update, trigger should 2 parameters when null should inserted values , when not null should new values,however trigger's syntax correct result incorrect alter trigger [dbo].[ordersupdate] on [dbo].[orders] after update declare @updatedate datetime, @updateuser uniqueidentifier set @updatedate=(select updatedate deleted) set @updateuser=(select updateuser deleted) if @updatedate null begin set @updatedate=(select updatedate inserted) end else set @updatedate=(select updatedate deleted) if @updateuser null begin set @updateuser=(select updateuser inserted) end else set @updateuser=(select updateuser deleted) insert updaterows select 'orders', id,@updatedate,@updateuser, convert(nvarchar,invoiceid,1)+'_...

How to test puts in rspec -

i want run ruby sayhello.rb on command line, receive hello rspec . i've got this: class hello def speak puts 'hello rspec' end end hi = hello.new #brings object existence hi.speak now want write test in rspec check command line output in fact "hello rspec" , not "i unix" not working. have in sayhello_spec.rb file require_relative 'sayhello.rb' #points file can 'see' describe "sayhello.rb" "should 'hello rspec' when ran" stdout.should_receive(:puts).with('hello rspec') end end also, need see test should in rspec please. you're executing code before entering test block, expectations not being met. need run code within test block after setting expectations (e.g. moving require_relative statement after stdout.... statement), follows: describe "sayhello.rb" "should 'hello rspec' when ran" stdout.should_r...

html - Creating a radial menu using very limited css and js -

so know question of how make radial menu has come before , aware people have done absolutely amazing things already, but! have make 1 , can't use more css , js. problem is, have implement menu on clients piece of crap drag , drop editor. doesn't have fancy installed , isn't wonderful environment work in. to make matters worse, has compatible ie8. know. trust me. i thinking of using bunch of divs shaped triangles layered on each other, have cut off of tips poking out. not sure how that. any ideas? by way, triangle idea: http://imgur.com/ycweoje

python - ValueError: numpy.dtype has the wrong size, try recompiling -

i installed pandas , statsmodels package on python 2.7 when tried "import pandas pd", error message comes out. can help? thanks!!! numpy.dtype has wrong size, try recompiling traceback (most recent call last): file "<stdin>", line 1, in <module> file "c:\analytics\ext\python27\lib\site-packages\statsmodels-0.5.0-py2.7-win32.egg\statsmodels\formula\__init__.py", line 4, in <module> formulatools import handle_formula_data file "c:\analytics\ext\python27\lib\site-packages\statsmodels-0.5.0-py2.7-win32.egg\statsmodels\formula\formulatools.p y", line 1, in <module> import statsmodels.tools.data data_util file "c:\analytics\ext\python27\lib\site-packages\statsmodels-0.5.0-py2.7-win32.egg\statsmodels\tools\__init__.py", li ne 1, in <module> tools import add_constant, categorical file "c:\analytics\ext\python27\lib\site-packages\statsmodels-0.5.0-py2.7-win32.egg\statsmodels\tools\t...

java - Select next node after specific condition -

i'm trying select next node value (number 4) after span tag in html below. how can that?? <tr valign="top"> <td></td> <td><a href="#"> 1 </a></td> <td><a href="#"> 2 </a></td> <td><span> 3 </span></td> <td><a href="#"> 4 </a></td> <td><a href="#"> 5 </a></td> <td><a href="#"> 6 </a></td> </tr> final string html = "<tr valign=\"top\">\n" + " <td></td>\n" + " <td><a href=\"#\"> 1 </a></td>\n" + " <td><a href=\"#\"> 2 </a></td>\n" + " <td><span> 3 </span></td>\n" + " <td><a href=\...

strict - Are there any differences between our defined variables and normal global variables in Perl? -

is our modifier used when strict pragma active let using global variables or used features different normal global variables when strict off? yes, our declarations can have additional features when compared undeclared globals. these largely irrelevant. our creates lexical alias global variable (of same name). is, in package foo , our $bar , $foo::bar refer same variable. however, former available in tight lexical scope. as our has lexical effect, alias can shadow lexical variables my : our $foo = 42; # give value $foo = -1; # same name, different value "my gives $foo"; our $foo; # reintroduce alias; shadow lexical "our gives $foo"; if strip our declarations , run without strict, won't give output my gives -1 our gives 42 just my , our can take bit declaration syntax, e.g. attributes : use threads::shared; our $foo :shared; you can specify type usage fields pragma: our foo $foo; this can't done global variable...

iphone - UICollectionView and Custom Height -

i'm using uiviewcontroller inside uicollectionvieww, , searched on internet how can customize height of total uicollectionview. setup uicollectionview height >= 1 (i'm using autolayout) in .m file tried with: uicollectionviewflowlayout *flowlayout = [[uicollectionviewflowlayout alloc] init]; [flowlayout setitemsize:cgsizemake(160, 160)]; [flowlayout setscrolldirection:uicollectionviewscrolldirectionvertical]; [flowlayout setminimuminteritemspacing:0]; [flowlayout setminimumlinespacing:0]; nsinteger itemcount = [self.collectionview numberofitemsinsection:0]; [flowlayout setitemsize:cgsizemake(self.collectionview.frame.size.width, 160 * itemcount)]; [self.collectionview setcollectionviewlayout:flowlayout]; nslog(@"%f", self.collectionview.frame.size.height); but in nslog still show me height 1...how can setup height of uicollectionview custom height(that based on element in section * 160). suggest ? thanks. edit: create cells: -(uicollectionviewcell *)co...

css - Div tags extending beyond their own margins -

Image
i have weird issue occurs regardless of browser (chrome, ie, opera mobile emulator i've tried). have divs nested within 2 other divs, shown below. these divs set 100% width. innermost element drifts outside of (but stays "under") parent divs. i'm not floating anything, don't see why doing this. using overflow: hidden has no effect see. image below shows google chrome's inspect element feature, shows element , padding extending beyond margins (shown in peach color). want within margins should be. i'm starting think may media queries i'm doing. using these because single percentage width won't give me exact width want. it's shamefully stupid on behalf, has ever seen this? css @media , (max-width:960px) {.container{width: 900px; } } @media , (max-width:1280px) {.container{width: 1024px; }} /*more media queries few other max resolutions*/ .container { height: auto; min-width: 300px; max-width: 1440px; margin: 20px auto ...

php - curl no response echo print -

i wondering why im not gettting response. uncommented curl in php.ini in php in xampp. (i found other post should uncomment curl part of php.ini in apache , php4 folder there 1 php.ini, found in php dir). also before uncommented curl part, browser give unrecognized function error. after uncommented it, okay, guess okay in part. <?php $whmusername = "my_email"; $whmpassword = "my_password"; $query = "https://api.appannie.com/v1/accounts"; $ch = curl_init(); // sets url curl open curl_setopt($ch, curlopt_url, $query); // here's http auth // 3rd argument twitter username , password joined colon curl_setopt($ch, curlopt_userpwd, $whmusername." : ".$whmpassword); // makes curl_exec() return server response curl_setopt($ch, curlopt_returntransfer, true); // , here's result json $response = curl_exec($ch); curl_close($ch); echo 'code line went here 1,'; print $response; echo $response; echo 'code line successful here...

bash - Linux, code that checks there are no currently running cron jobs? -

how write bash script checks there no running cron jobs, simple action? i not talking cron jobs scheduled run @ point, referring actively running processes. thanks! intresting question ;) for pid in `pgrep cron`;do ps uh --ppid $pid; done|grep -v cron

php - Zend 2 annotations and file validators -

is possible use file validation classes form annotations? /** * @form\name("profile_avatar") * @form\type("zend\form\element\file") * @form\options({"label":"your avatar"}) * @form\validator({"name":"zend\validator\file\isimage"}) */ public $profile_avatar; with code above form valid if send non-image file. i think have use "isimage" name... had similar problem hostname valuidator. didn't solved because can't options working...

geolocation - GPS ground coverage -

here idea track sprayer coverage on farm android app. use get??location provide gps coordinates use coordinates plug polyline maps api v2 set polyline width according boom width. (conversion require pixel distance conversion @ different zoom levels. how display ground coverage polyline if footage on map change zoom level? correct me if i'm wrong, polyline uses pixels defined width. idea require user input width of sprayer in feet , program have calculate polyline width based on zoom/pixel ratio. you should not draw poly line, because spray path forms closed polygon. must draw polygon line width = 0 (or minimum line width); fill polygon. for such precision farming usuallay better gps devices used centimeter accuracy. (using rtk)

css - Google Fonts Font Doesn't load -

i'm trying add pt sans newsletter, reason isn't loading i've copied of code, isn't working. grateful can help. here css code: h1, h2, h3 { font-family: 'pt sans', sans-serif; } and html code: <link href="http://fonts.googleapis.com/css?family=pt+sans" rel="stylesheet" type="text/css"> edit: here's rest of css: h1, h2, h3 { font-family: 'pt sans', sans-serif; } #logo{width:810px} #savedatetext{ position:relative; top:30px; left:80px; font-size:50px; color:rgb(228,242,214) } #october{ position:relative; top:0px; left:90px; font-size:35px; color:rgb(228,242,214) } #raftlogo{ position:relative; top:-125px; left:550px; } #savethedate { background-color:rgb(123, 190, 48); height:170px; width:810px; } #honoring { position:relative; background-color:rgb(9, 65, 30); width:810px; top:-30px; font-size:20px; he...

c# - Match nested HTML tags -

in c# app, want match every html "font" tag "color" attribute. i have following text: 1<font color="red">2<font color="blue">3</font>4</font>56 and want matchcollection containing following items: [0] <font color="red">234</font> [1] <font color="blue">3</font> but when use code: regex.matches(result, "<font color=\"(.*)\">(.*)</font>"); the matchcollection following one: [0] <font color="red">2<font color="blue">3</font>4</font> how can matchcollection want using c#? thanks. regex on "html" antipattern. don't it. to steer on right path, @ can html agility pack : htmldocument doc = new htmldocument(); doc.loadhtml(@"1<font color=""red"">2<font color=""blue"">3</font>4</font>56"); va...

testing - Django test module ignores choice restrictions -

so have model has restricted choices, 'developer' , 'charity'. if change radiobutton values on actual form other those, django comes error message should. in testing accepts value seems. in short test shouldn't fail does. or django should raise integrity error or something. i have problem testing foreign key field in profile, that's perhaps best saved different question. model code snippet: # models.py user_type = models.charfield(max_length=30, choices={ ('developer', 'developer'), ('charity', 'charity'), }, blank=false, null=false) however, when following in testing, there's no error message: # tests.py def test_no_user_type(self): my_values = self.default_values my_values[self.user_type] = 'something' # row creates , saves user , profile. user, profile = self.save_user(my_values) # thou...

Java Enum Default Explicit Constructor not Defined -

i guarantee stupid question, having brain block , can not figure out how fix error. working in java , trying define enum. public enum shooterstatus{ off,extending,contracting,loaded } this enum defined within class. when compiling, following error: implicit super constructor enum(string, int) undefined default constructor. must define explicit constructor what missing here? shouldn't enum declaration that? (i used programming in c) containing class: package org.usfirst.frc3777; import edu.wpi.first.wpilibj.doublesolenoid; import edu.wpi.first.wpilibj.speedcontroller; import edu.wpi.first.wpilibj.timer; public class shooter { public enum shooterstatus{ off,extended,contracting,loaded } speedcontroller uppercont; speedcontroller lowercont; doublesolenoid ds; boolean isloaded; boolean isrunning; timer maintimer; doublesolenoid.value extend = doublesolenoid.value.kforward; doublesolenoid.value compress =...

javascript - Get DOM element of watch event in Angular.JS -

i have 2 select boxes on web page, , when state chosen first 1 use angular load in options second. when page first loads, second select box has 1 item, select state... , after first item changed, want change select... . is possible access dom element through angular make change, or must use full-on jquery selector in example: $scope.$watch('state', function() { $http.get('institutions?state=' + $scope.state).success(function(institutions) { $scope.institutionoptions = institutions; // avoid jquery selector if possible... $('[name=institution_id] option:first').html('select...'); }); }, true); i think should stick data binding as possible. bind $scope.message : js: $scope.message = "initial message" html: <select ng-model="selected" ng-options="c.o c in options"> <option value="">{{message}}</option> </select> when receive data, c...

html - div inside form rails -

i have these markup on rails application these form not working when tr <div class="span5 mg myform"> <div class="span5 mg"> <ul class="clearfixremo formmenu"> <li class="lefty blocky boldy rightbrd"><i class="icon-pencil"></i> post</li> <li class="lefty blocky boldy myphotoupload "> <i class="icon-camera"></i> photo</li> </ul> </div> <div class="span5 mg"> <div class="row"> <div class="span4"> <%= simple_form_for(current_user.posts.new, :remote => true ,:html => { :multipart => true } ,:class=>"form-horizontal" ) |f| %> <div class="field"> <%= f.text_area :body ,:rows=>1%> <%= f.select :privacy,["public","friends","only me"] %> </div> </div> </...

How can I set an instance variable with a date_select form in Rails? -

i have archive page want user able select date , pull microposts created on date. think close figuring out, cannot figure out how set instance variable date_select form. have method in controller looks this: def archive @date_search = [] end i want set instance variable empty set can assigned later. partial feed looks this: <ol class="microposts"> <%= render partial: 'shared/feed_item', collection:micropost.where("date(created_at) = ?", @date_search) %> </ol> i can assign @date_search value in controller , show posts date seems work. need able set variable form. date form looks this: <%= form_for(@date_search) |f| %> <div class="field"> <%= f.select_date date.today, :prefix => :date_search %> </div> <%= f.submit "submit", class: "btn btn-lrg btn-primary" %> <% end %> but doesn't work. maybe using wrong kind of select date f...

ruby - Why do I get "Uninitialized Constant" from Rails? -

i created route: user_currency /user/currency/:currency(.:format) user#currency this user controller: class userscontroller < applicationcontroller require 'will_paginate/array' require 'gdata' before_filter :ensure_user_friendly_url, :only => [:show, :following, :followers, :friends, :designers] before_filter :check_if_signed_in, :only => :signup and controller route: def currency session[:currency] = params[:currency] redirect_to :back end i getting error: uninitialized constant usercontroller the error occurs here: - currency_values.each |currency| %li = link_to "#{currency.country}", user_currency_url(currency.id) i passing currency_id currency. in route declaration refer controller name incorrectly. should be: user_currency /user/currency/:currency(.:format) users#currency basically controller userscontroller not usercontroller .

asp.net mvc 3 - MVC3 - How to check if user clicked on the link you sent through e-mail in .net? -

i'm running e-commerce website , send customers regular newsletters. i'm using nopcommerce v2.40. see subscribed. want develop detailed newsletter management system, mailchimp. want report on how many users clicked on link sent them via e-mail. can tell me how that?? pretty generalized question i'm new @ , have no idea how it. thank ! you can sort of thing quite google analytics. here links worth looking at. google analytics email tracking setting campaign tracking in google analytics

Best way to instantly check proximity to one of two locations in Android? -

i'm writing app utilizes parse cloud data storage. told people i'm writing opening second location, , know location user checking in to/recording data at. i've found google code at: http://developer.android.com/training/location/geofencing.html that defines how use geofencing, how last known gps/network location. http://developer.android.com/guide/topics/location/strategies.html but can't tell if either 1 of these need. i'm trying following: user starts app user clicks "check in" check in class @ gym when "check in" activity loads, user can click class. @ point in time i'd know if user say...within 5 miles of central lat/long. 2 locations around 20 miles apart, rough estimate putting them within few miles should fine (are in sunnyvale or san jose?) when user clicks class, check-in gets sent parse database, along location (either 1 city or other) i'm not sure if geofencing proper case, need know rough area point..but...

ios - iphone development: launching app on receiving push notification -

in app can receive push notifications. however, if app in background, when open app faced last state of app. want is, if app on background, opening notification should relaunch app first time app opening. possible? in appdelegate react receipt of notification , restore application state in way appropriate app. for example if main view controller uinavigationcontroller , user may have navigated down in view hierarchy, pop navigation controller's rootviewcontroller: [[self navigationcontroller] poptorootviewcontrolleranimated:yes];

cocoa touch - What is the best way to delegate UIButtons,UITextFields etc? -

in apps delegating uibuttons,uitextfield,pickers etc.i able delegate these 3 ways. 1-i control+dragging buttons,text field etc story board .h file creates delegation directly. 2-in .h file creating buttons,text fields etc , making connections. 3-programmatically doing delegations i want know best way it. best way use storyboard referencing outlets , delegates. if not able use storyboards codding. storyboards save time of codding there no major difference this.