Posts

Showing posts from July, 2011

osx - Mac OS or Linux - Change year but leave Month Day Hours & Seconds untouched -

i need recurse directory tree , update year portion of timestamp files year. can't work out how touch. can't use touch -a since the target files have many different years relative adjustment out. i want update years 2013 regardless of need leave rest of time stamp untouched. possible? any appreciated. thanks, steve. #!/bin/sh #this ensure output of commands in english export lang=c #gets modification date file, can change other timestamp instead. moddate=$(stat $1 | fgrep modify | cut -d" " -f2) year=2013 #sets month , day old date month=$(echo $moddate | cut -d- -f2) day=$(echo $moddate | cut -d- -f3) newdate=$year-$month-$day #sets new date touch -d $newdate $1

ipc - Create shared memory for several processes by using only native C++ operations? -

how can allocate shared memory accessible multiple processes using native c++ operations? or should use os api in case of inter thread synchronization objects such mutex , semaphores are? (i mean can not use bool instead of mutex. os has specific types organizing synchronization.) there no notion of "shared memory", or "process", in "only native c++". platform-specific concepts. you can try boost's interprocess library useful abstractions.

vb.net - Delay in reading from specific database -

i have application written in vb.net reads data sql server 2008 r2. @ time of login, user select 1 of many database files (available in dropdown list) , keys in username , password login. while logging in, application reads table in selected database called 'strings' , while loop put values in 25-30 variables creating working environment of application. i have put in time tracking @ beginning , end of while loop , shows 1 of database, takes 26 seconds read values , takes 0 seconds (since not tracking @ mili-seconds level). ironically, 'strings' table in database takes 26 seconds has 125 rows , database takes 0 seconds has 159 rows. apparently, code same, , database structure true replica (both databases generated using same script). i have thought of possibilities not sure why there's such huge difference delays login time of user. can please put light on how can figure out? thanks without specific information rather difficult find going on. r

python - invalid syntax error python3 -

can please explain error message me please file "game.py", line 3, in <module> import random file "/usr/lib/python3.2/random.py", line 40, in <module> types import methodtype _methodtype, builtinmethodtype _builtinmethodtype file "/home/twitches/documents/types.py", line 6 print x i used () print in line 6 print("hello") the traceback pretty clear. have file, same name, standard python module - types . rename/move file /home/twitches/documents/types.py

javascript - Design decisions in TodoMVC for Backbone Marionette example -

i wondering why in todomvc backbone marionette , marionette.layout used footer instead of simple itemview header ? also why use compositeview todolist.views.listview instead of collectionview ? i don't see need using layout in footer. think author thought maybe need add regions footer , used layout , in actual implementation? no need. about compositeview instead of collectionview . collectionview doesn't allow have template on it. imagine need show list of clients don't want simple <ul> show clients, want headers, information , <ul> compositeview can add template can contain header, information , of course <ul> . in concrete case, wants show checkbox list, since needs show markup apart <ul> needs compositeview able add template. tl;dr use collectionview if don't need markup , if so, use compositeview

ios6 - using saved GPS coordinates from CLLocation to plot on the iPhone map -

i have been using core data save user's location various times in table view. can location details (coordinates mainly) @ various times, plot coordinates available @ each time on mapview (no overlays, single point point location @ time). have coordinates (one latitude , 1 longitude value) available, know how plot them on mapview. just put question simply, how 1 can plot coordinates on mapview ? i browsed through , not able find exact solution solve problem ! appreciated. thanks time ! regards, raj. with of mkannotation, problem can solved. @craig , vishal kurup ! create annotation class subclass of nsobject. in annotation.h: @interface annotation : nsobject <mkannotation> @property (nonatomic, assign) cllocationcoordinate2d coordinate; @property (nonatomic, assign) nsstring *title; @property (nonatomic, assign) nsstring *subtitle; @end it should conform mkannotation , 3 properties ones required when conforming mkannotation class. declare , syn

dom - Return edited XML string with Javascript -

i'm using the xml < script > library w3c dom parser available here . (this because i'm using js inside .net cli jint program instead of browser.) my problem is, edit xml using domimplementation.loadxml() function , edit 1 node value, want retrieve string xml including modified one: //instantiate w3c dom parser var parser = new domimplementation(); //load xml parser , domdocument var domdoc = parser.loadxml($xmldata); //get root node (in case, rootnode) var docroot = domdoc.getdocumentelement(); // change "name" element value docroot.getelementsbytagname("name").item(0).nodevalue="john"; // try retreive xml including changed 1 $xmldata=docroot.getxml(); sample xml: <name>carlos</name> all works except last line: docroot.getxml(); which returns original xml string , not modified one. any idea how can retreive xml string including modified? fixed replacing: docroot.getelementsbytagname(&q

html - bxslider javascript install -

hi cannot bxslider work in html file, have downloaded files , put them relevant directories etc images displayed 1 after in block format when run page in firefox. the code using follows: <!doctype html public "-//w3c//dtd xhtml 1.0 strict//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>ac</title> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <meta name="author" content="ac" /> <meta name="description" content="ac" /> <meta name="keywords" content="ac" /> <link href="./index.css" rel="stylesheet" type="text/css" /> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></scri

Use JBPM without console in WebLogic -

my purpose integrate jbpm (in particular version 3.2.1) in weblogic(last version 12c). have resolved many problem of compatibility , integration jbpm still doesn't work, in particular console. it's possible use jbpm without console? (i'm new in use of jbpm , bpm in general). help. jbpm console should able run on weblogic (you need configure different transcation manager , persistence etc. different set up). can use jbpm without console @ all, embed jbpm engine in webapp.

c - Why does a call to fread set my file pointer to null? -

i have file pointer valid before calling fread, , null after, , i'd know why. here relevant code: 244 // open file reading 245 clo->heap_file = open_file(heap_path, "rb"); 443 // allocate memory read page file 444 file_page = safe_malloc(clo->page_size); 446 // read page in memory file 447 read_page(file_page, clo); void * safe_malloc(size_t size) { void * mem_block = null; mem_block = calloc(1, size); if (mem_block == null) { fprintf(stderr, "error: safe_malloc() failed allocate memory.\n"); exit(exit_failure); } return (mem_block); } file * open_file(char * file_name, char * file_mode) { file * fp; char * err_msg = ((strcmp(file_mode, "rb") == 0) ? "file not found" : "file not created"); fp = fopen(file_name, file_mode); /* print appropriate error message , exit if open failed */ if (fp == null) { fprintf(stderr, "%s: %s\n",

html - How to set cellspacing in CSS on non-table elements set to display:table-cell? -

how set cellspacing in css on non-table elements set display:table-cell? http://jsfiddle.net/david_knowles/ysyzj/ <dl> <dt>definition title 1</dt> <dd>def detail 1.1</dd> </dl> <dl> <dt>definition title 2</dt> <dd>def detail 2.1</dd> <dd>def detail 2.2</dd> </dl> dl {display:table-cell; margin:1em; background-color: #eee; vertical-align: top; padding:1em;} dt {margin: 2px 0; padding:1em; font-weight: bold;} dd {margin: 2px 0; padding:1em; } edit: curious why border-spacing doesn't work in situation? just using display:table-cell on element creates invisible (and anonymous) table around it. can accomplish border-spacing dl tags creating div container them display:table , border-spacing:(value) as boltclock mentioned, border-spacing style applies tables need create 1 contains table cells. css div { display:table; border-spacing:5px; border-collap

Android Studio and Gradle build error -

i've been using new preview of android studio , it. project won't build. following error: gradle: failure: build failed exception. * went wrong: execution failed task ':testproj:compiledebug'. > compilation failed; see compiler error output details. * try: run --stacktrace option stack trace. run --info or --debug option more log output. not execute build using gradle distribution 'http://services.gradle.org/distributions/gradle-1.6-bin.zip'. question how enable stack trace can root of error. have no idea what's causing this. if using gradle wrapper (the recommended option in android studio), enable stacktrace running gradlew compiledebug --stacktrace command line in root folder of project (where gradlew file is). if not using gradle wrapper, use gradle compiledebug --stacktrace instead (presumably). you don't need run --stacktrace though, running gradlew compiledebug itself, command line, should tell error is. i based

javascript - iOS app doesn't fetch same results as Foursquare -

i've been wondering quite while, i'm using foursquare's api use within ios app. it works wonderfully except fetched results never matches made foursquare app itself. i find weird, places aren't in list. anyone has ever experienced this? simplest query results aren't same. is there docs on how foursquare's app handle filters/requests? thanks edit: use venues/search ll lat,lng . this may due other parameters foursquare app passing in. have specific examples cause behavior? you try debugging foursquare app through web proxy. show api requests it's making, can pin down what's going on. did writeup of technique here: http://nickfishman.com/post/50557873036/reverse-engineering-native-apps-by-intercepting-network at least don't seem 1 seeing behavior: foursquare venues api returns incorrect data checkin intent

php - Wordpress action starting before it's done -

i'm trying create new bbpress forum when new post saved...i made out code thing it's infinite loop. strange loop starts not when save post, first, when go in "all posts" or in "new posts". what's problem please? this code <?php add_action('save_post', 'register_forumcustom'); function register_forumcustom($post_id){ $post = get_post($post_id); // create post object $my_new_post = array( 'post_title' => 'forum di'.$post->post_title, 'post_content' => '', 'post_status' => 'publish', 'post_author' => 1, 'post_type' => 'forum' ); // insert post database $new_forum_id = wp_insert_post( $my_new_post ); //ok, maybe here loop starts, know problem because there "save_post". can solve this, don't understand other problem! update_post_meta($post_id, "forum_

html - jQuery Content Reveal swipe Carousel with Tabs -

i have been asked have @ creating carousel mobile, requires: - carousel slider swipe left , right content carousel (not images) tabs @ top can tap , slide left / right finally left , right divs visible showing 15px off screen (similar facebook app on feeds when people upload >3 images. i have attached image demonstration purposes. http://i41.tinypic.com/1qmj51.png so can see package 1 , 3 visible show user there more content can swipe though, , having tabs. tab tab swipes left or right , active tab changes? are there plugins out there this? thanks

asp.net mvc 3 - Upload File via MVC3 -

i'm trying upload file via mvc3 view : @{ viewbag.title = "pic"; layout = "~/areas/admin/views/shared/_adminlayout.cshtml"; } @using (html.beginform("fileupload", "blog", formmethod.post)) { <input name="uploadfile" type="file" /> <input type="submit" value="upload file" /> } and actions : public actionresult fileupload() { return view(); } [acceptverbs(httpverbs.post)] public actionresult fileupload(httppostedfilebase uploadfile) { if (uploadfile.contentlength > 0) { string filepath = path.combine(httpcontext.server.mappath("../uploads"), path.getfilename(uploadfile.filename)); uploadfile.saveas(filepath); } return view(); } what wrong code ?? have error object

Joining 2 SQL Servers -

i trying search 2 servers (a , b). server has database prod_a , server b has prod_b. prod_a has table1 , prob_b has table2. how can merge 2 tables 2 different sql servers? done setting link servers having issues query syntax. thanks. you need create linked server, using sp_addlinkedserver (documented here ). on server issue command: sp_addlinkedserver serverb then access remote table using: select * serverb.prod_b.dbo.table2 this four-part naming convention remote tables. assumes remote table in schema called "dbo". if not, change right schema. if have permissions problems, post question. if want access them in 1 query, put tables in 1 query select * serverb.prod_b.dbo.table2 join prod_a..table1 on . . .

c++ - Cocos2dx for Windows Phone : VS2012 raise bunch of errors -

i porting game based on cocos2dx ios windows phone 8. problem here after change fix errors of differences of api, got bunch of syntax errors, undeclared variable (although these variable declared). here sample code: .h file: #ifndef __bomb__ #define __bomb__ #include "moveableobject.h" typedef enum bombtype { bombtypeelectrical, bombtypeice, bombtypechemical, bombtypesmall, bombtypebig } bombtype; class bomb : public moveableobject { public: bomb() {}; bomb(const char* szname); virtual ~bomb() {}; void settype(int ntype) { m_ntype = ntype; }; int gettype() { return m_ntype; }; bool isexploding() { return m_bexploding; }; int bombtypeforname(const char* szname); void expode(); void activate(); void finishexploding(); protected: bool m_bexploding; int m_ntype; }; #endif and error mark here: bomb::bomb(const char* szname) : moveableobject(szname), m_bexploding(false) { m_ntype = this->bo

c++ - Bitmap Loading Breaks When Switching to Vectors over Arrays -

in recent change switch program using arrays vectors when creating buffer, totally unrelated problem surfaced. switch involves creation of std::vector<std::vector<std::vector<glfloat> > > terrainmap; instead of glfloat[size+1][size+1][4] terrainmap . initialize 3-d vector, use terrainmap.resize(size+1); (int = 0; < size+1; ++i) { terrainmap[i].resize(size+1); (int j = 0; j < size+1; ++j) terrainmap[i][j].resize(4); } this "map" parameter of many classes modify contents setup program through void terrain::load(std::vector<std::vector<std::vector<glfloat> > >& terrainmap,state &current){ strange part though, when creating totally unrelated bitmap for texturing, break point hit , going further results in heap corruption. here code image loading. bmp = loadbmp("dirt.jpg"); which extends into... bitmap object::loadbmp(const char* filename) { bitmap bmp = bitmap::bitmapfromfile(resource

Can't install Ruby on Rails with RVM on Ubuntu 13.04 -

i trying install rvm on ubuntu machine. i have used curl rvm, rvm commands (install, requirements) throw apt-get error: there has been error while updating 'apt-get', please give time , try again later. 404 errors check sources configured in: /etc/apt/sources.list /etc/apt/sources.list.d/*.list type rvm | head -1 returns rvm function -bash: type: write error: broken pipe which gem /usr/bin/gem i have checked "run command login shell" option steps followed tutorial : sudo apt-get install curl curl -l get.rvm.io | bash -s stable --auto . ~/.bash_profile rvm requirements - doesn't work i have looked @ official rvm documentation , seems similar. any ideas? update: managed it. disabled third party ppa urls , installed smoothly. there important packages system needs before install rvm. run @ terminal: sudo apt-get install build-essential openssl libreadline6 libreadline6-dev \ curl git-core zlib1g zlib1g-dev libssl-dev li

gpu - VS 2010 Video Card switching -

i have intel(r) hd graphics , nvidia geforce gtx 660. now writing opengl aplication in visual studio 2010. checking opengl version, results opengl 3.3, think it`s running on hd graphics. i appreciate if tell me how can change it.

php - how to auto fill and submit html form with curl -

i want auto fill html form , submit form , display result. used below code got here . <?php //create array of data posted $post_data['email'] = 'myemail'; $post_data['pass'] = 'mypassword'; //traverse array , prepare data posting (key1=value1) foreach ( $post_data $key => $value) { $post_items[] = $key . '=' . $value; } //create final string posted using implode() $post_string = implode ('&', $post_items); //create curl connection $curl_connection = curl_init('http://m.facebook.com/'); //set options curl_setopt($curl_connection, curlopt_connecttimeout, 30); curl_setopt($curl_connection, curlopt_useragent, "mozilla/4.0 (compatible; msie 6.0; windows nt 5.1)"); curl_setopt($curl_connection, curlopt_returntransfer, true); curl_setopt($curl_connection, curlopt_ssl_verifypeer, false); curl_setopt($curl_connection, curlopt_followlocation, 1); //set data posted curl_setopt($curl_connection, curlop

windows runtime - How to do binding to Datacontext in different page -

i have textblock in mainpage.xaml. have page has textblock value bound observable collection , value changes depending on user events on page. how can bind textblock value in other page textblock value in mainpage.xaml? can please guide me resources or examples may explain how or workaround? well, can't directly bind properties of 2 controls on different pages since aren't displayed @ same time. you'll need store state elsewhere , retrieve values there. basically you'll need store application state somewhere, either inside app class or singleton/static properties. alternativelly persist state between pages (to file or setting) , retrieve again when loading page. in case should bind controls in both pages view model retrieve values application state or stored there. way values set 1 page reflect on other one. depending on how navigate between pages might able take advantage of parameters ( frame.navigate(typeof(otherpage), parameter) ) you're

c++ - Missing type specifier On a Templated List Class using Templated Nodes -

this contents of graph.h without header protects , other functions template <class t> class node{ public: t data; node<t> *nextnode; public: node(); node(t a); t getvalue(); void setvalue(t a); void chainnode(node<t> a); void chainnode(node<t> *a); node<t> getnextnode(); void unchainnode(); }; //related methods template <class t> node<t>::node(){ data = null; nextnode = null; } template <class t> void node<t>::chainnode(node<t> a){ nextnode = null; nextnode = &a; } template <class t> void node<t>::chainnode(node<t> *a){ nextnode = null; nextnode = a; } template <class t> class list{ public: node<t> *head; list(node<t> a); void addinfront(node<t> a); void addinfront(node<t> *a); void append(node<t> a); bool remove(node<t> a); bool remove(t a); bool contai

mysql - When is JOIN executed in this case? -

let's select data table "posts": id | bigint(20) | pk text | varchar(400) and table "likes": user_id | bigint(20) post_id | bigint(20) those 2 fields joined primary key let's select on table "posts" 500'000 records simply select id, text posts limit 0,20 and need know posts have (there can 1 per user/post, see primary-key definition). do select id, text posts left join likes on posts.id = likes.post_id limit 0,20 will query join on 20 records or on 500'000 of table "posts"? no column of "likes" used in where/group clause in effective query. output of explain select id posts left join likes on posts.id = likes.post_id limit 0 , 20 id select_type table type possible_keys key key_len ref rows 1 simple posts index null primary 16 null 58 using index 1 simple likes ref primary primary 8 legendaily.posts.id 1 using index thanks

php - Changing the center of rotation of Imagerotate -

Image
imagerotate rotates image using given angle in degrees. the center of rotation center of image, , rotated image may have different dimensions original image. how change center of rotation coordinate x_new , y_new , avoid automatic resizing? example: rotation around red dot. first idea comes mind move image new center @ x_new, y_new rotate , move back. assumptions: 0 < x_new < w 0 < y_new < h pseudocode: new_canter_x = max(x_new, w - x_new) new_center_y = max(y_new, h - y_new) create new image (plain or transparent background): width = new_canter_x * 2 height = new_center_y * 2 copy old image new 1 coords: new_center_x - x_new new_center_y - y_new imagerotate new image. now have cut part interested in out of it.

winapi - SetWindowText Slow, Win32 C++ -

i've got simple application i'm reading internal variables , posting them editcontrol's on menu. here code snippet case 0: setwindowtext(getdlgitem( ghwnd, idc_packetid ), (lpstr)std::to_string(long long(nc->mpacketnum)).c_str()); break; so there's lot going on there. i'm trying convert number can shown in edit dialog. slow, can drop 50hz 30hz entering section. any ideas speed significantly? i have gotten around type of problem maintaining timestamp of last window update. prevent update unless amount of time had passed. 1/10th of second seemed work pretty me. performance improved noticeably , updates still looked smooth.

php - Adding to shopping cart [Drag and Drop] -

i trying create virtual shopping basket. there items [from database] there virtual basket users can drag items , put inside basket. [like buying in shopping mall]. after user clicked save button, shopping cart saved. is there anyway this? yes. you’ll need couple technologies. html5/css3 position , style items , cart jquery ui drag , drop effects: http://jqueryui.com/draggable/ ajax send dragged/dropped items php handler php store items in session , process transaction

ios - cs193p assignment 4 flickr fetcher returns an empty array -

i following itunesu lecture of stanford cs193p class, , on assignment 4 right now. after entered api key in header file , try log returned array console, shows empty array nothing in it. code provided not working anymore since there has been changes flickr api? the flickrfetcher class code can accessed here: http://www.stanford.edu/class/cs193p/cgi-bin/drupal/system/files/assignments/flickrfetcher.zip thanks lot! i tried flickr key , works. called so: nslog(@"%@", [flickrfetcher topplaces]); by way, doing fall 2011 version of course ios 5 based. there new winter 2013 version of course ios 6 based can found here: https://itunes.apple.com/us/course/coding-together-developing/id593208016

Convert Integer to Double in MIPS -

i want divide 2 values in $tn registers. i have divide these 2 values double result function div returns integer part of division can out? do need convert $t1 , $t2 $f0 , $f2 ? how do that? li $t1,2 li $t2,5 div $f0,$t2,$t1 this gives me error because expects $tn value not $fn value... you have move , convert integer stored in general purpose register floating point or double register. assuming number stored in $a1 , convert double pair ( $f12 , $f13 ) have issue: mtc1.d $a1, $f12 cvt.d.w $f12, $f12 and convert single precision float ( $f12 ) you'd do: mtc1 $a1, $f12 cvt.s.w $f12, $f12

php - Conflict with 3 different RewriteRules in .htaccess? -

i'm using below in .htaccess file. there 3 types of redirects: redirect directory /admin/index.php redirect specific .php files e.g. /about redirect user profile page /john all 3 work on local environment, on server 1 , 3 works. i'd appreciate tell me why file redirects of type /about not working me. many thanks. <ifmodule mod_rewrite.c> options -multiviews options +followsymlinks rewriteengine on rewritebase / rewriterule ^admin$ /admin/index.php [qsa,l] rewriterule ^about/?$ /about.php [qsa,nc,l] rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^([_a-z0-9a-z-+\.]+)/?$ /public_profile.php?id=$1 [l] </ifmodule> errordocument 404 /404.php

node.js - how to save file with request in json nodejs? -

i'm trying save result json file when see goes in half, wrong in code not understand part, help. var request = require("request"); var cheerio = require("cheerio"); var fs = require('fs'); var urls = ["http://www.fordencuotas.com.ar"] var req = function(url){ request({ uri: url, }, function(error, response, body) { var $ = cheerio.load(body); $("a").each(function() { var link = $(this); var itri = {iti: new array(link.attr("href"))} var data = json.stringify(itri); fs.writefile("file.json", data, function(err){ if(err){console.log(err);} else {console.log("archivo guardado..");} }); }); }); } (var = 0; < urls.length; i++){ req(urls[i]); } console.log("cargando..."); this output [opmeitle@localhost crawler1]$ node crawmod.js cargando... archivo guardado.. archivo guardado.. archivo

html5 - how to swap sections with javascript -

i'm beginner html5 , javascript , i'd create basic function swap section's positions event. the function 1 working, swapping section "con" top, function 2 doesn't work. please, can me? function swap1() { document.getelementbyid("top").style.position = "absolute"; document.getelementbyid("con").style.top = "50px"; } function swap2() { document.getelementbyid("con").style.position = "fixed"; document.getelementbyid("top").style.bottom = "300px"; } <section id="top" onmousedown="swap1()"> <video width="500" height="500" controls> <source src="http://techslides.com/demos/sample-videos/small.mp4" type=video/mp4> </video> </section> <section id="con" onmouseover="swap2()"> <hr> <p>text.</p> </section> it because after r

android Asynctask call method in Activity -

i downloading video ftp-server via asynctask , save on device. after download (onpostexecute) want play video directly in videoview in activity, problem can't call playvideo method since not static , instead have tried call in onresume() method, get() method, progressbar in asynctask doesn't show , app later crashes. suggestion? thank in advance public class playstreamedvideo extends activity { final string tag = "playstreamedvideo"; private videoview videoview; private mediacontroller mediacontroller; private downloadvideo download; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.guessvideo); setrequestedorientation(activityinfo.screen_orientation_portrait); download = new downloadvideo(playstreamedvideo.this, save_path); download.execute(); } @override protected void onresume(){ try { while(download.get() == false){

graphics - .NET - Overriding printer's default for color -

i printing color printer. printer's default setting color black-and-white . have tried following, when open printer's preferences dialog, color still set black-and-white. prints in black-and-white. want preferences dialog reflect changes made code. do? this code runs when click on 'print' button: if printdocument1.printersettings.supportscolor printdocument1.defaultpagesettings.color = true else printdocument1.defaultpagesettings.color = false end if vb2010, gdi+, winforms

php - MVC htaccess rewrite - hide index -

i have basic mvc structure restful uri design of: mysite.com/appdir/:index/:controller/:action/ and want hide index route parameter uri looks like: mysite.com/appdir/:controller/:action/ my basic folder structure is: appdir/ app/ -->controller/ -->model/ -->view/ config/ library/ public/ -->.htaccess -->index.php .htaccess index.php appdir/.htaccess: <ifmodule mod_rewrite.c> rewriteengine on rewriterule ^$ public/ [l] rewriterule (.*) public/$1 [l] </ifmodule> appdir/public/.htaccess: <ifmodule mod_rewrite.c> rewriteengine on rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^(.*)$ index.php?url=$1 [pt,l] </ifmodule> <ifmodule !mod_rewrite.c> errordocument 404 index.php </ifmodule> i can't seem hide index, i've tried number of rewrite rules , nothing seems work. codeigniter, can add rewrite

tfs2012 - Registration of COM Components on Team Foundation Services (Azure) -

one of projects requires com server registered on build machine. first (and only) lame attempt simple pre-build step, assumed not work in cloud, , correct. problem is, need use component, have binary, , i'm bit stumped do. the error message predictable: the command "regsvr32 /s "path_to_dll" exited code 5. please verify have sufficient rights run command. tfs azure in preview @ moment, i'm not sure how many people have experience yet. posted same question on official forums , have not yet received response. searching did not either. silly me, need reference interop assembly instead of directly referencing native dll. problem solved.

spring - How to create a servlet on the fly -

for below url's receive 404 error, fine since url's not exist. possible create these servlets while server running before error page returned ? http://127.0.0.1:8888/test1 http://127.0.0.1:8888/test1/test2 i'm thinking perhaps create generic controller intercepts urls if current servlet not exist, create ? assuming spring mean spring mvc , this: @controller public class yourcontroller { @requestmapping("/mappinga") public void methoda() { // (...) } @requestmapping("/mappingb") public void methodb() { // (...) } // catches non-matched requests. @requestmapping("/*") public void fake404(httpservletrequest request) { var uri = request.getrequesturi(); // (...) } }

network programming - Is ip_hdr() on a sk_buff guaranteed to work? -

when dealing sk_buff in kernel modules code, see many code samples use either (struct iphdr *)skb_network_header(skb) //skb instance of (struct sk_buff*) or function ip_hdr() same (calling skb_network_header , casting). safe? if don't have assumptions on sk_buff came from, there check can make sure network protocol indeed ip? edit: may point there can sk_buff possible network protocol ip, still see "proof" or explanation that. if implement own protocol in linux kernel example , network protocol header may else? how can make sure network transport protocol indeed ip? skb refers socket buffer, data structures used represent , manage packets in linux kernel. , implementation of linux network system designed independent of specific protocol. socket buffer in linux kernel network system give more details. to question: caller called skb_network_header() should guarantee knows protocal. proof : can find out many references skb_network_header(), includin

php - Remove href links and label using html dom parser -

first getting html of web page , removing href links appear on left or right side of page (not in page body). href links being removed labels not being removed. example: <a href='http://test.blogspot.com/2012/11/myblog.html'>london</a> links being removed not it's label i.e. 'london'. how can remove complete row in html source? using following code it: $string = strip_tags($html_source_code, '<a>', true); function strip_tags($text, $tags = '', $invert = false) { preg_match_all('/<(.+?)[\s]*\/?[\s]*>/si', trim($tags), $tags); $tags = array_unique($tags[1]); if(is_array($tags) , count($tags) > 0) { if($invert == false) { return preg_replace('@<(?!(?:'. implode('|', $tags) .')\b)(\w+)\b.*?>.*?</\1>@si', '', $text); } else { return preg_replace('@<('. implode('|', $tags) .'

iis - Using URL Rewrite to change part of URL -

i'm trying use url rewrite on iis 8.0 rewrite existing url:s on developer machine. reason don't want change existing (old) code. what i'm trying achieve change following code in response stream: <a href="http://www.foo.com/path/page.asp?a=1">foo page</a> into: <a href="http://www.foo.localhost/path/page.asp?a=1">foo page</a> but when i'm trying, end with: <a href="foo.localhost">foo page</a> and know, not satisfying result. so - how do rewrite proper achieve i'm trying do? i know there better ways of doing this, using application variables etc., it's old solution , don't want mess application itself. want keep changes minimum. @ least begin with. the rules tried this: <system.webserver> <rewrite> <outboundrules> <rule name="foo.com" enabled="true"> <match filterbytags="a, area, base, form, frame,

selenium webdriver - Launch chrome browser -

i trying launch chrome browser (version 26.0) using webdriver. getting following error message. exception in thread "main" java.lang.illegalstateexception: path driver executable must set webdriver.chrome.driver system property; more information, see http://code.google.com/p/selenium/wiki/chromedriver. @ com.google.common.base.preconditions.checkstate(preconditions.java:176) @ org.openqa.selenium.remote.service.driverservice.findexecutable(driverservice.java:105) @ org.openqa.selenium.chrome.chromedriverservice.createdefaultservice(chromedriverservice.java:69) @ org.openqa.selenium.chrome.chromedriver.<init>(chromedriver.java:107) @ googlesearch.main(googlesearch.java:13) code used: driver = new chromedriver(); driver.navigate().to("http://www.google.com/"); i use mac 10.8.2. for work, need to: install chrome install chrome web driver make sure have chrome web driver in path, example on windows pointing chromedriv

c# - How would it be possible to have a Windows Phone 8 application interact directly with a Windows PC ? (Using WP8 as an input device for Windows 8) -

i'm trying create windows phone 8 application can send mouse movements phone windows 8/7 pc. can't find place start being there's no documentation of being possible other few rdp client apps in app sore (which can't find how). how possible have windows phone 8 application interact directly windows pc ? yes is. @ end of day you're trying communicate windows computer. keyboard , mouse simple devices simple drivers. computer computer communications have establish form of connectivity first. for example if wanted keyboard keyboard's driver been installed. how driver , app communicate down of course. the simplest way have thought have service on pc listens device's communications , control pc on behalf. lucky there service built windows this. it's called windows remote desktop services . have talk rdp it. there open source rdp clients available. if doing project start , determine i'd need do. find windows phone 8 os has rdp client api

javascript - menu change page information -

i'm trying have multiple dropbox menu's on same page change information on next page after submitting selection. so user can make different , multipule selections menus click "submit" , different information on next page , not same page script below. this closest thing ive found trying information on next page instead proving tricky. <form> <table> <tr> <td>person 1</td> <td>information</td> <td> <select id="choice1" onchange="changetext('choice1', 'display1')"> <option>select</option> <optgroup label="category 1"> <option>g1 choice1</option> <option>g1 choice2</option> </optgroup> <optgroup label="category 2"> <option>g2 choice1</option> <option>g2 choice2</

javascript - How can I invoke encodeURIComponent from angularJS template? -

i have block in angular js template la <a href="#/foos/{{foo.id}}">{{foo.name}}</a> however, foo.id property can contain funky characters ('/'). want this: <a href="#/foos/{{encodeuricomponent(foo.id)}}">{{foo.name}}</a> but doens't work? how can fix this? you create filter calls encodeuricomponent e.g. var app = angular.module('app', []); app.filter('encodeuricomponent', function() { return window.encodeuricomponent; }); then do <a href="#/foos/{{foo.id | encodeuricomponent}}">{{foo.name}}</a> running example: http://jsfiddle.net/yapdk/

zebra printers - Need to print the captured user signature in the specified position in java -

we capture user signature through tablet. (we done part) need replace captured signature "$signature" in below content , send printer. "the content similar below. hereby declare that, to the best of knowledge and belief,  the particular given  above and the declaration  made therein are true. name $name date $date signature $signature" we need solutions in java if want replace string other string, can use replace() method of string class. example: string name = "somename"; string content = "name $name date $date signature $signature"; string result = content.replace("$name", name); system.out.println(result); output: name somename date $date signature $signature apply same other parameters.

java - gettext-commons per-request locale in servlet -

the gettext-tutorial states the preferable way create i18n object through i18nfactory. factory caches i18n object internally using the package name of provided class object , registers i18nmanager. classes of same package use same i18n instance. but running inside httpservlet (actually velocityviewservlet in particular case) seems me if change locale on cached object stay subsequent requests , not desirable because each request must served particular locales. so question is, should instead create ad-hoc i18n objects on per-request basis, specific locale of request? think performance penalty, should instead create own manager , select appropriate instance based on request's locale? any comments appreciated. there doesn't seem doc or examples besides tutorial , javadoc. update: there 1 thing tried , seems work. instead of declaring private static member tutorial says, call factory method on each request, using special version of i18nfactory: geti18n(java.lang

Javascript e vs. object? Chome Inspector -

i'm working on small project leaflet , , trying diagnose why using map.load event returning object [object object] has no method 'load' (although load event firing properly) when inspect variable containing map object in chrome instead of saying object {foo: bar} it says e {foo: bar} what e represent? can provide pictures of chrome inspector output if help. var map = l.map('map', {maxzoom: 16, minzoom: 4, zoomcontrol: false}) .setview([46.5675115, 17.468262], 6); map.load(mapinit()); function mapinit() { console.log('ive loaded'); } load event, not method. need use on attach event listeners: map.on('load', mapinit);

C# Accessing an Entity Framework Class with only Type Information -

ok, question tough me explain new generics , many of high level features of c#. trying write method using generic type used both instantiate new object of type , use type information access correct class in entity framework 5.0 dbcontext. have not compile believe code better explain problem, wording vague explain trying do. code public void addnewrecord<t>() t : new() { t record = new t(); _context.t.add(record); //here problem t tbl_x _bindsource.datasource = _context.t.local.tobindinglist(); //same goes here } how can use t access class in dbcntext? not sure possible. appreciate guys/gals can offer. you want this: _context.set<t>().add(record); _bindingsource.datasource = _context.set<t>().local.tobindinglist(); i notice context class member. careful using dbcontext way, dbcontexts designed short lived, , slower , slower , user more , more memory without giving if keep around life of program. dbcontext not real mem

mysql - How do i write this query -

here problem using case expression, display author’s first name concatenated last name separated space concatenated “ is: “. concatenate previous result slogan based on value in state column. if state “ca” display “sunny”. if state “co”, display “a rarity”. if state “fl”, display “a peach”. if state “ny”, display “likes apple pie”. name column “author characteristics”. order result “author characteristics”. here code have written far select concat(au_fname, au_lname, ' is: '), case state when 'ca' 'sunny' when 'co' 'a rarity' when 'fl' 'a peach' when 'ny' 'like apple pie' else 'state' end "author characteristics" authors order 1; the problem having output giving me 2 columns, 1 titled concat statement , second column titled author characteristics. need 1 field information 1 title. just make case argument concat . select

java - Why does Ant recognize some env vars but not others -

i have 2 env vars defined: myuser@mymachine:~$ echo $ant_home /home/myuser/apache/ant/1.8.4/apache-ant-1.8.4 myuser@mymachine:~$ echo $ant_ivy_home /home/myuser/apache/ivy/apache-ivy-2.3.0-rc2 i have following ant build: <property environment="env"/> <target name="testant"> <echo message="ant home: ${env.ant_home}"/> <echo message="ant ivy home: ${env.ant_ivy_home}"/> </target> when run testant following console output: buildfile: /home/myuser/eclipse/workspace/myapp/build.xml testant: [echo] ant home: /home/myuser/apache/ant/1.8.4/apache-ant-1.8.4 [echo] ant ivy home: ${env.ant_ivy_home} build successful total time: 316 milliseconds why ant recognize ant_home not ant_ivy_home ? in advance! did merely set ant_ivy_home , not export it?

PHP ini_set override php.ini -

this question has answer here: why syntax error return http error 500 when 'display_errors' on? 2 answers in php.ini, have display_errors set off, on of pages on site don't want errors show up. however, i'm writing new thing, , want errors on. @ top of script, put error_reporting(e_all); ini_set('display_errors', 'on'); but errors didn't display, got http error 500. so turned on in php.ini, , did display. so there way can make errors display in places want to, in general, don't display? many help the way turning on display_errors in php.ini , using error_reporting(0); in place turn off error reporting , error_reporting(e_all); turn on them

winforms - How to continuosly update the textbox in C# -

i have following piece of code: class notepadclonenomenu : form { protected textbox txtbox; public notepadclonenomenu(string a) { text = "notepad clone no menu"; txtbox = new textbox(); txtbox.parent = this; txtbox.dock = dockstyle.fill; txtbox.borderstyle = borderstyle.none; txtbox.multiline = true; txtbox.scrollbars = scrollbars.both; txtbox.acceptstab = true; txtbox.appendtext(a); txtbox.appendtext("\n"); } } class program1 { public static void main() { string result = "abc"; while(true) { application.run(new notepadclonenomenu(result)); } } } i want continuously appending string result textbox looks this: abc abc abc so on , forth. however, every time called this: application.run(new notepadclonenomenu(result)); it reset textbox. there anyway can update textbox continuousl

c++ - When to use " . " or " -> " operators to access attribute or member function? -

in both c, c++ , objective-c, can use . or -> access values or functions. differences or drawbacks between two? you can treat a->b (*a).b in c -language

javascript - jquery select tag not being brought to front -

i have following function, brings given element front, , changes couple of properties. element in question select box. function expandtags(event){ var pos = $(this).position(); $(this).css("position", "absolute"); $(this).css("left", pos.left + "px"); $(this).css("top", pos.top + "px"); $(this).css("height", $(this)[0].scrollheight + 20 + "px"); $(this).attr("size", $(this).data("list_item").data("tags").names.length); $(this).css("zindex", 9999); } the code works, except zindex - while element updated have value, seems have no affect. when select box's height expanded, overlaps select box (essentially identical) in row below it. in front of select box. regardless of set boxes zindex to, remains on top. the html of boxes after action follows: 1 should on top. <select style="width: 100px; height: 173px; position: absolute; z-index:

drupal - Drupal6: $THEME_URL how to change themes based on full domain path -

i have function in settings.php: $theme_urls = array( array('/optoelectronics','optotemp'), array('/power-devices','optotemp'), ); foreach ( $theme_urls $info) if ( strpos($_server['request_uri'],$info[0])===0) $conf['theme_default'] = $info[1]; ..but, i've realized pre-processing , drupal output happens before hitting settings.php in case above, site have sharing content on different domain get's above 'optotemp' theme applied since has /optoelectronics section/page. i tried using www.sitea.com/optoelectronics doesn't seem work. i need drupal recognize absolute path, actual domain , not /optoelectronics part. so, have custom page path url /optoelectronics , 2 variants. variant served has selection rules based on domains. works perfectly. now, since sitea has new theme needs keep old theme /optoelectronics section thought above function work discovered serves theme no matter actual

linked list insert function recursively c++ -

i'm writing insert function recursively adding element list.the problem when run program , trying insert, inserts once, @ second time breaks , has bug. suggestions, thanx helper function: void list::inserthelper(node* list, int number) { if(list->next != null) { inserthelper(list->next, number); } else { list->next = new node; list->next->data = number; } } this function when call recursive one: void list::insert( int d) { if( head == null) { head = new node; head->data = d; } else { inserthelper(head, d); } } you problem absence of following: list->next->next = null; in else part of inserthelper. "suggestions" part, avoid processing lists recursively if can it. (future) coworkers won't appre

list - C error: request for member ___ in something not a structure or union -

so code saying list , size not structure? typedef struct hashtable{ int size; listref **list; } hash; typedef struct hash *hash_ref; hash_ref *newhash(int size){ hash_ref *hashed= null; if(size<1){ return null; } if( (hashed=malloc(sizeof(hash))) ==null){ return null; } if( (hashed->list=malloc(sizeof(listref*)*size)) ==null){ return null; } for(int i=0; i<size; i++){ hashed->list[i]=null; } hashed->size=size; return hashed; } here list function typedef struct node{ long key;/*book id*/ listref data; struct node* next; struct node* prev; }nodetype; typedef nodetype* noderef; typedef struct listhdr{ noderef first; noderef last; noderef current; long length; }listhdr; i wondering whats error? forgot add listhdr changed listref in list header file.. included in hashtable module. i'm trying create 2 hash tables. 1 has table stores 2 long

cordova - calling a method in js file which is defined in other js files jquery -

i have implemented method in file1.js file function setlist(){ db.transaction(querydb, errorcb); } and trying call method in file2.js $(function() { setlist(); }); but method not getting called , getting error 05-19 14:05:37.545: e/web console(9341): referenceerror: can't find variable: setlist @ file what mistake doing? thanks:) seems nothing wrong. make sure file1.js imported before file2.js

autofac - Component registration override -

we produce toolkit can supported various ioc containers, toolkit ioc-agnostic , provide basic support different containers. working support autofac, need allow end users override our configuration, part, based on conventions. i'll explain happens windsor understand if there similar mechanism autofac. the toolkit provides set of built-in services/component "automagically" registrated in end-user container. windsor register "fallback" if user register same service "default" user component resolved overriding our registration. the interesting thing of approach works regardless of order in components registered. any way achieve same behavior autofac? .m i think you're looking preserveexistingdefaults extension. can read more in autofac wiki: https://code.google.com/p/autofac/wiki/componentcreation

How can I stop a HTML page after the <head>...</head> loads using javascript? -

i have url rewriting proxy server (ezproxy) can set provide one-click access target url's, providing authentication challenge when needed getting out of way when it's not needed. http://url-rewriting-proxy-server.com/login?url=http://target-url.com i load url above , stop page, loading <head></head> . i use bookmarklet (server side code ok) accomplish this. can programmatically javascript? if so, how? if javascript bad idea, there alternatives? will solution work in mobile safari? maybe window.stop(); is looking for

c# - opening browser using a get method url -

i'm trying open default web browser application, far i'm using: process.start("view.html"); and works, if want open browser url like: "view.html?var=something" using process.start trows file not found error , cant find way tell open still file method specified. thanks help edit: done in way: string browserstr = path.getfullpath(config.page_local_url) + _p; process.start("opera.exe", browserstr).waitforinputidle(); anyway, there way find default browser , pass function should not specify it? try this: process.start("view.html", "?var=something");

javascript - Bootstrap carousel start on load with wordpress -

i have used twitter bootstrap on handbuilt sites , carousel start cycling on load. however, using wordpress theme , can't life of me figure out how start cycling. carousel works wont cycle on load http://drdavidpier.koding.com/lauras-wordpress/ i have tried adding in various bits of script related carousel('cycle') , interval methods bootstrap docs nothing seems change. if can me on please let me know should amend/add script. thanks in advance! this should job: jquery('#mycarousel').carousel({ interval: 2000 }) but i've noticed ready event isn't working , code doesn't executed. please try replace scripts.js code this , tell me if it's working. edit : basically did replacing $ jquery , change of code structure.

android - showing a FragmmentDialog from calls that extends View class -

i have activity called mainpage , extends sherlockfragmentactivity . activity has tabs, each tab shows different fragment. 1 of fragments displays salerow view custom view (class extends relativelayout class). have saledialog class extends dialogfragment . trying show saledialog salerow view class. tried use code: public class salerow extends relativelayout { public salerow(context context) { super(context); ... this.setonclicklistener(new onclicklistener() { @override public void onclick(view view) { fragmentmanager fm = getfragmentmanager(); //compilation error here getfragmentmanager method getfragmentmanager() undefined type new view.onclicklistener() saledialog testdialog = new saledialog(); testdialog.setretaininstance(true); testdialog.show(fm, "fragment_name"); } }); i have search solution co

semantic web - How can I model a complex relation between two resources? -

consider having relation/predicate between 2 resources: <#a> <#isrelatedto> <#b>. i want add properties <#isrelatedto> relation: relation strength, description, etc. so model this: define instances of predicate , add properties instances similar described here use quad store have unique id triple , add properties triple (problem have use triple store because of database restriction) define class of relations (isrelatedtoclass) have <#from>, <#to>, <#relstrength>, <#description> properties. create instances of class represent relation , connect , b. e.g.: <#isrelatedtoinstance1> <rdf:type> <#isrelatedtoclass> <#isrelatedtoinstance1> <#isrelated/from> <#a> <#isrelatedtoinstance1> <#isrelated/to> <#b> <#isrelatedtoinstance1> <#isrelated/relstrength> "2" <#isrelatedtoinstance1> <#isrelated/description> "some desc"

Ruby Tweetstream MongoDB Error -

i keep getting following error when running following ruby script. if can me fix appreciated. i've removed sensitive data such api keys. code: #!/usr/bin/env ruby require "tweetstream" require "mongo" require "time" tweetstream.configure |config| config.consumer_key = 'key' config.consumer_secret = 'secret' config.oauth_token = 'token' config.oauth_token_secret = 'token_secret' config.auth_method = :oauth end db = mongo::connection.new("ds045037.mongolab.com", 45037).db("tweets") auth = db.authenticate("db_username", "db_password") tweets = db.collection("tweetdata") tweetstream::daemon.new("twitter_username", "twitter_password").track("term") |status| # things when nothing's wrong data = {"created_at" => time.parse(status.created_at), "text" => status.text, "g