Posts

Showing posts from July, 2012

applescript - What kind of files are valid Xcode behavior scripts? -

i'm trying set applescript behavior in xcode 4, xcode won't allow me select script. kind of file valid script xcode? i've tried .applescript , .scpt , , .txt . i've tried no extension @ all. what need do? this neglecting read the documentation on creating new behavior . (ios developer login required.) it turns out xcode can accept executable file script. solution run chmod +x on script file , xcode allowed me select it. it's funny, because wasn't aware finder allowed filtering based on chmod permissions.

angularjs - Angular JS table with ng-repeat and radio buttons -

i trying make table using ng-repeat has radio button selector @ start of each row. table looks this: <table> <tbody> <tr ng-repeat="model in modellist"> <td> <input type="radio" ng-model="model.select"></input> </td> <td>{{ model.ndpname }}</td> <td>{{ model.oem }}</td> <td>{{ model.version }}</td> <td>{{ model.dateadded }}</td> <td>{{ model.validuntil }}</td> </tr> </tbody> </table> the ng-repeat taking modellist looks like: $scope.modellist = [ { select: false, ndpname: "ndp1", oem: "choam inc.", version: "01", dateadded: "jan 1, 2013", validuntil: "jan 1, 20

php - Running 2 projects on apache server -

i have 2 projects in htdocs folder: project1 , project2. running project1 on mamp server. it's located on localhost:8888 (default location provided mamp). want run second project2. changes need make happen? i added httpd.conf file this, it's not working. there elegant way this? <virtualhost *:8888> servername zf2-tutorial.localhost documentroot /applications/mamp/htdocs/zf2-tutorial-1/public setenv application_env "development" <directory /applications/mamp/htdocs/zf2-tutorial-1/public> directoryindex index.php allowoverride order allow,deny allow </directory> </virtualhost> <virtualhost *:8888/secondproject> servername zf2-tutorial2.localhost documentroot /applications/mamp/htdocs/zf2-tutorial-2/public setenv application_env "development" <directory /applications/mamp/htdocs/zf2-tutorial-2/public> directoryindex index.php allowoverride order allow,deny allow </directory> <

c++ - Qt: can't find -lGL error -

i reinstalled qtcreator, created new project ( qt application ) got after compilation: /usr/bin/ld: **cannot find -lgl** collect2: error: ld returned 1 exit status make: *** [untitled1] error 1 18:07:41: process "/usr/bin/make" exited code 2. error while building/deploying project untitled1 (kit: desktop qt 5.1.0 gcc 32bit) when executing step 'make' ( project empty, did'n commit changes ) qt creator 2.7.2 based on qt 5.1.0 (32 bit) ubuntu 13.04 how solve problem? install package "libgl1-mesa-dev": sudo apt-get install libgl1-mesa-dev

php - Abraham twitteroauth response parsing -

i'm having heck of time figuring out how parse out error message when twitter throws error. here's code, works fine post tweet: $response = $twitteroauth->post('statuses/update', array('status' => $msg)); $e = $twitteroauth->http_code; if $e != 200 , want twitter's error message. if var_dump($response) , like object(stdclass)#6 (1) { ["errors"]=> array(1) { [0]=> object(stdclass)#7 (2) { ["code"]=> int(187) ["message"]=> string(21) "status duplicate" } } } how parse out message status duplicate ? if need 1 message value should work. $message = $response->errors[0]->message;

semantic web - Duplicate output results with SPARQL -

this question has answer here: aggregating results sparql query 1 answer i'm new semantic web concept, , have diploma work based on semantic web. in owl ontology, have defined individuals in following manner: <announce rdf:id="ann1" ...> <...> <...> <requiredtechnologies> <technology rdfs:resource="tech1"/> </requiredtechnologies> <requiredtechnologies> <technology rdfs:resource="tech2"/> </requiredtechnologies> </announce> ... basically, there properties appear once given individual, property "required technologies" can used multiple times in 1 record (for 1 individual). so, when run sparql query, selecting data (i use jena), output: ===================================== | "ann1" | ... | ... | "tech1" | | "

jquery - Event handlers inside javascript object literal -

i'm trying create object , assign click handlers within it. have realised can't how want due "this" becoming associated button, instead of object literal, breaking access functions. "uncaught typeerror: object # has no method 'clearselection'" please see below fiddle. http://jsfiddle.net/ebkk8/ and here code reference. it's not supposed useful @ stage, except illustrate problem :) function thingconstructor(somedata) { var button = $("#somebutton"); return { initialise: function () { button.click(function () { // want "this.clearselection();" target // "clearselection" function below. // instead, targets button itself. // how can refer it? this.clearselection(); }); }, clearselection: function () { this.populatelist($("#stuff"), somedata);

javascript - jQuery prop parent checkbox from directory listing pulled from PHP -

my goal "prop" parent checkbox in nested list. right pull in directory listing in php this: function listdirectories($dir, $i, $howdeep) { $lastfolder = end(explode("/", $dir)); $liststring .='<li class="closed"><span class="folder"><input type="checkbox" class="userpermissioncheckbox" parent="'.$i.'" howdeep="'.$howdeep.'" value="'.$dir.'" />'.str_replace('_', ' ', $lastfolder).'</span>'; foreach (glob($dir."/*", glob_onlydir) $d) { $howdeep++; $liststring .='<ul>'; $liststring .=' '.listdirectories($d, $i, $howdeep).' '; $liststring .='</ul>'; $i++; $howdeep = 1; } $liststring .='</li>';

In Django, how do I return a form back to a Javascript function? -

in template, have javascript send call django method. in method return blank form template. here's javascript: require(["dojo/request/xhr", "dojo/domready!"], function(xhr, ready){ var url = window.location.pathname + "dev/" + report_id + "/" + report_url + "/"; xhr(url, { method: "get" }).then( function(response){ var json_response = json.parse(response); //do stuff } ); }); here's what's happening in django view: def my_view(request): if request.method == "get": form = myform() data = json.dumps({ 'form': form, }) return httpresponse(data, mimetype="application/json") else: #do other stuff here's error i'm getting right now: raise typeerror(repr(o) + " not json serializable") typeerror: &

java - Display complete jtextarea content into single cell of excel file during export. -

Image
i developing 1 desktop application functionality of exporting jtable content excel file. now here flow of project code implementing:- after importing jtable excel, data written in way:- (only single record in jtable) now here data exporting in proper way except our remarks & client report. i have tried implement setlinewrap() , setwrapstyleword() still not working. here code above functions our remarks textarea:- txtourremarks.setlinewrap(true); txtourremarks.setwrapstyleword(true); can me out in this? thanks. i guess problem have new line characters in output file. need replace characters blank character appear on single line in excel.

ruby - Resque - Not Processing Queue -

i have web based app built using sinatra. recent needing collect data @ regular intervals , store them in database. told use resque , clockwork gems in combine. every hour or need 15 calculations based on database , store results in database. so approach took. decided make 15 classes have perform method ( exact file used testing below ). thing similar resque.enqueue( graphdata ) 15 classes. class graphdata @queue = :graph_data def self.init() end def self.perform() file.open( '/home/ziyan/desktop/resque.txt', 'a' ) { | file | file.write( "resqueu - performed - #{time.now}\n" ) } end end to trigger operation testing purposes, created rake task. desc "start resque workers queue" # {{{ task :graph_data |t| env["queue"] = "*" env["vverbose"] = "1" env["interval"] = "5" resque.enqueue( graphdata ) #resque = resque.new #resque << ad

performance - Python Function Takes too Long as Dictionary Gets too Big -

def assign_id(dic,id): key, value in enumerate(dic): elem in range(value): if id in dic[value]: return value my function above want do-- problem dictionary dic gets bigger in main part of program, "assign_id" function takes long. function takes 1/100 of second run, after few thousand rows of input, starts take half second, full second , longer. trouble input file large function makes whole program take @ least 2 full days run. is there way re-write above function runs quicker? able periodically run program want run faster does. thank in advance help! well, straight off bat, rid of enumerate . also, second for-loop nothing. rid of too: def assign_id(dic, id): key in dic: if id in dic[key]: return key the above function should old 1 does, far faster.

android - Cloudant/CouchDB Permissions on Key/Pass not working -

i having problem getting information cloudant.com using key/pass read permissions (or permissions). receiving 500 error way setup user. however, working fine, have left myself open hacking, have have database open read everyone. , know can problem. wondering if has insight why problem happens. btw, have tried in both android , ios applications. current question using examples android app. here criteria singleton utopia: private static string _remote_db_protocal = "https"; private static string _remote_db_key = "mykey"; private static string _remote_db_pass = "mypass"; private static string _remote_db_account = "myaccount"; private static string _remote_db_dbname = "mydbname"; public static string remote_json_db_url = _remote_db_protocal+"://"+ _remote_db_key+":"+_remote_db_pass+"@"+ _remote_db_account+".cloudant.com/"+_remote_db_dbname; here information sending url strin

java - How can I embed a PApplet object into an ordinary applet? -

i have processing sketch written in java ( not processing ide) , embed java applet can run web browser's java plugin. processing sketches created extending class called papplet in turn extends component, in principle should quite easy. indeed, this guide explains how embed jframe; this documentation relevant. problem have little experience applets , can't figure out how modify examples have. can help? andrew right, papplet is a applet(generalization, extends, etc.) functionalities applet has, processing papplet have plus more. it's matter of exporting applet. processing 2.0 removed export applet option, it's still present in processing 1.5.1 can stable releases porcessing downloads another alternative using eclipse proclipsing plugin. plugin allows create processing project (papplet subclass, etc.) , export applet or application. although heavier minimal processing editor, you've got loads of nifty tools in eclipse auto-complete , refa

jQuery show/hide select and button -

i wondering how can show different buttons once click it. example: <input type="button" value="submit" id="button1"> <input type="button" value="submit" id="button2" style="display: none;"> <input type="button" value="submit" id="button3" style="display: none;"> <select id="whatever"> <option id="1">1</select> <option id="2">2</select> <option id="3">3</select> </select> <select id="whatever2" style="display: none;"> <option id="1">1</select> <option id="2">2</select> <option id="3">3</select> </select> i want button1 show select id "whatever" , button 2 hide select id="whatever" , show "whatever2" , button 3 same thing. thanks!

objective c - Obj-C/iOS is a data structure like a plist okay or is something like coredata more easily used? -

i'm looking build reporting system, have canned reports, , user created reports, each report i'll need name, description, , information contain below structure i've jsonlint'ed represent data single report called "review progress" (inside canned report structure) need. { "canned": [ { "name": "review progress", "description": "quick @ ...", "contents": { "collections": [], "filters": [], "facets": { "review status": [ { "reviewed": { "value": "300", "enabled": "true" } }, { "not reviewed": { "value&quo

svg - d3js - need to find the full size of g element -

i using d3js create graph. retrieve size of graph use elsewhere in code in javascript. when inspecting element in firebug , going layout tab, shows dimensions in pixels trying grab programatically. however, trying grab g typing $('g').height() returns 0. there special way supposed grab element full rendered height , width? the svg way call element. getbbox() . give object width , height properties.

c++ - Generating enum class members with a macro -

i want create enum 255 elements follows: enum class myenum { item0, item1, //.... item254, item255 }; is there way generate members of enum using macro instead of listing them all? well, seems op after boost_pp_enum_params . won't it's best solution, work enum values these: enum class myenum { boost_pp_enum_params(256, item) };

jquery - check for spacing or - in a text filed -

i'm trying check empty spacing or - character in textfield. can use - function isvalid( str ){ var is_valid = true; if(str.indexof('-') === -1){ is_valid = false; } return is_valid; } but want combine method checks multiple - , empty spacing between characters. example enter string this. var str = "emp t y" want check if empty space present or if this. var str = "12-34-55" i'd suggest: function isvalid( str ){ return !(/-|\s/.test(str)); } simple js fiddle demo . references: javascript regular expressions . regexp.test() .

javascript - Prevent web page refresh -

there's periodic page refresh on page ( http://sosconso.blog.lemonde.fr/2013/07/24/mes-vacances-ne-se-passent-pas-comme-prevu/ ), wondering how worked , how prevent (using greasemonkey example). i'm user of site, can play browser options, or use greasemonkey alter javascript. the page doesn't appear use meta refresh tag i'm bit puzzled.

rails 4 rake task fails on heroku [uninitialized constant MODEL] -

i have model screenshot.rb. defined following rake task namespace :clean_up_temp desc "clean unsaved screenshots 1 hours ago" task :screenshots => :environment screenshot.destroy_all([ 'created_at<? , title null', 1.hours.ago ]) end end it works locally. failed on heroku running `rake clean_up_temp:screenshots` attached terminal... up, run.2861 rake aborted! uninitialized constant screenshot /app/lib/tasks/clean_up_temp_screenshots.rake:3:in `block in <top (required)>' /app/lib/tasks/clean_up_temp_screenshots.rake:1:in `<top (required)>' /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/engine.rb:641:in `block in run_tasks_blocks' /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/engine.rb:641:in `each' /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/engine.rb:641:in `run_tasks_blocks' /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/application.rb:244:in `run_t

python - sqlite memory usage issue for db file size > 2GB when creating index -

i have simple sqlite database 2 tables. table 1: col1: int index; col2: text; col3: int; table 2: col1: int; col2: int; col3: int; the first table goes millions of rows. table 2 can have hundreds of millions rows. table 1, col2 indexed after data entered. indexes created table 2 col1, col2. the index creation works fine when database file size small - < 3.5gb. when database file system > 3.5gb, see memory error. this linux system, on 32 bit kernel, file size >2gb seems cause memory error during index creation. on 64 bit kernel, limit > 3.5gb. from "top" program, see vm , rss usage goes 3.5gb on 64 bit system before die. have seen this? suggestions on how work around issue. have luck sqlite multi gb file size + index creation? use newer sqlite version avoid eating memory. (3.7.16 works me.) ensure there enough free space on /tmp , or move tmpdir elsewhere.

CSS3 box shadow only on top left and right corners -

Image
i need create shadow effect client can't figure out how done: is possible pure css? edit: here current css: box-shadow: 0 0px 0px #fff, 0 -1px 15px #ccc, 0 0px 0px #fff, 0 0px 0px #fff; -webkit-box-shadow: 0 0px 0px #fff, 0 -1px 15px #ccc, 0 0px 0px #fff, 0 0px 0px #fff; -moz-box-shadow: 0 0px 0px #fff, 0 -1px 15px #ccc, 0 0px 0px #fff, 0 0px 0px #fff; this other answer stole another stack overflow question use spread value... box-shadow has following values box-shadow: x y blur spread color; so use like.. box-shadow: 0px -10px 10px -10px black; here answer same question you can give multiple values box-shadow property eg -moz-box-shadow: 0px 10px 12px 0px #000, 0px -10px 12px 0px #000; -webkit-box-shadow: 0px 10px 12px 0px #000, 0px -10px 12px 0px #0

asp.net - Asp tabpanel updating all tabs -

i working on webpage displays online users in tabpanel, , want have update every x amount of seconds. part works; however, of other tabs in tabcontainer update too, not want. here code online user tab <cc1:tabpanel runat="server" headertext="online users" id="tabpanel1"> <contenttemplate> <div> <div style="position:relative; text-align:left; width:650px; top: 0px; left: 0px;"> <asp:label id="lblupdate" runat="server" text="this page refreshed automatically every 10 seconds, or press update button right"></asp:label> </div> </div> <asp:timer runat="server" id="timer1" interval="10000"></asp:timer> <asp:timer runat="server" id="timer2" interval="9000"></asp:timer> <asp:updatepanel runat=

python - How does the following code snippet work? -

i novice in python , going through opensource project called pyobd donour sizemore elm327(not sure,could aimed @ more scantool devices).i can make out following method convert hex value int.but how work? specially line eval in it. def hex_to_int(str): = eval("0x" + str, {}, {}) return eval runs string if python code, , outputs result. in case, runs 0xaf , way of specifying hexadecimal literal, , outputs resulting integer. try typing 0xaf python interpreter, , you'll integer result. eval not safe use on untrusted input. example, eval("0xa , __import__('os').remove('some/file/path')") could delete file on system. it better use ast.literal_eval or int : >>> import ast >>> ast.literal_eval("0xaf") 175 >>> int("af", 16) 175 which safe , produce same result.

Xml Deserialization with complex elements in c# -

this question has answer here: how deserialize xml document 12 answers i having troubles deserialization of xml string object. not getting errors values aren't populating (the values aren't null "" ). i've looked @ few questions had same issue problems consisted of people not having [xmlroot] or [xmlelement] defined. here bit of xml string: string xmlstring = @"<results><dpv_answer value=""y"" /><zip value=""95118-4007"" /></results>" here function deseralize: standardaddress address = new standardaddress(); using (xmlreader reader = xmlreader.create(new stringreader(xml))) { try { address = (standardaddress)new xmlserializer(typeof(standardaddress)).deserialize(reader); } catch (invalidoperationexception x) { // string passe

javascript - Adding text below the images in this JS slider -

i having trouble figuring out how add text underneath images in slider, it's functionality super simple, having trouble , thinking may have re write it, here html , js: <div id="look-book-scroll"> <a href="javascript:;" id="lookbook-left-advance"></a> <div id="lookbook-wrapper"> <div class="lookbook-image"> <%= image_tag(asset_path("img/page1.jpg")) %> <div class="lookbook-bl"> <p>hi gus!</p> </div> </div> <div class="lookbook-image"> <%= image_tag(asset_path("img/page2.jpg") ) %> </div> <div class="lookbook-image"> <%= image_tag(asset_path("img/page3.jpg")) %> </div> </div> <a href="javascript:;" id="lookbook-right-advance"></a> </div> js: // loo

dbix class - Relationship bridges in DBIC -

i have several bridges in 1 result class, have relationship same another result class. example in text class have several bridges user class. then, named default users , users_2s . can remap names rel_name_map option, question whether there semantic behind namings? how decided 1 named users , 1 named users_2s ? maybe if create tables in order on machine relationships named in order , users become users_2s , vice versa? if use rel_name_map , decide rename them can sure order preserved? short answer: database has names bridges, , dbix::class use names. you're safe having them being renamed between runs long aren't changing database between runs. if @ database right tools/commands should see names "users" , "user_2s" associated bridges. each "bridge" foreign key constraint, , such has name in source database schema. library function dbix::class::schema::loader::dbi::_table_fk_info calls dbd handler's foreign_key_info method

Jquery datepicker to show multiple color on date selection -

i have date picker shows active days. within these active days, need show different color on selecting each date instead of date picker's default color. have 3 array of dates determines color show. array1 = {8/5/2013, 8/14/2013, 8/21/2013} - background blue array2 = {8/15/2013, 8/22/2013} - background red array3 = {8/9/2013, 8/13/2013} - background green how can extend date picker achieve this? like this: jsfiddle example $('#dp').datepicker({ beforeshowday: colorize }); var bluedates = ['8-5-2013', '8-14-2013', '8-21-2013']; var greendates = ['8-15-2013', '8-22-2013']; var reddates = ['8-9-2013', '8-13-2013']; function colorize(date) { mdy = (date.getmonth() + 1) + '-' + date.getdate() + '-' + date.getfullyear(); console.log(mdy); if ($.inarray(mdy, bluedates) > -1) { return [true, "blue"]; } else if ($.inarray(mdy, greendates) > -1) {

Ajax PHP wont retrieve address bar variable -

this question has answer here: mysqli_fetch_array()/mysqli_fetch_assoc()/mysqli_fetch_row() expects parameter 1 resource or mysqli_result, boolean given 33 answers my current website address reads: www.mysite.com/index.php?user=123 i click link active ajax page open. ajax page contains following: $usernum = $_get["user"]; $result = mysql_query("select * persons user = $usernum"); this produces error: warning: mysql_fetch_array() expects parameter 1 resource, boolean given in c:\program files (x86)\ampps\www\social2\profile\indexbasics.php on line 29 no error ocurrs if hard code in user number though, refuses address bar variable. help? advice? ----- added info ------ <script> window.onload = function () { var basics = document.getelementbyid('basics'), favorites = document.getelementbyid('favorites'

asp.net - Creating an action filter attribute that bypasses the actual execution of the action and returns a value for it -

can create actionfilterattribute bypasses actual execution of action , returns value it? you can, this: 1) redirects action , return value: public class myfilterattribute : actionfilterattribute { public override void onactionexecuting(actionexecutingcontext filtercontext) { /*if happens*/ if (/*condition*/) { /*you can use redirect or redirecttoroute*/ filtercontext.httpcontext.response.redirect("redirecto somewhere"); } base.onactionexecuting(filtercontext); } } 2) write value direcly request , ends sending client: public class myfilterattribute : actionfilterattribute { public override void onactionexecuting(actionexecutingcontext filtercontext) { /*if happens*/ if (/*condition*/) { filtercontext.httpcontext.response.write("some value here"); filtercontext.httpcontext.response.end(); } base.ona

asp.net - Slow performance when using Paged Fetch -

i executing sql query using petapoco return around 4000 rows. here code builds sql: var sql = petapoco.sql.builder .append("select ") .append("participants.participantid") .append("from participants") .append("inner join organizations") .append("on participants.orgid = organizations.orgid") .append("left join departments") .append("on participants.departmentid = departments.departmentid") .append("where") .append("participants.orgid = @0", 6328); .append("and participants.last_name @0", "p%"); .append("and ") .append("participants.orgid in ") .append(" (") .append(" select") .append(" orgid ") .append(" ") .append(" organizations") .append(" where") .append(" associat

iphone - Stop automatic dismissal of keyboard on iOS/disablesAutomaticKeyboardDismissal not called -

i able have control become first responder yet keep keyboard showing user. i found disablesautomatickeyboarddismissal in uiviewcontroller , overrode never get's called (ios 5.0) is there reason method not called? there way keep keyboard showing though it's not required first responder? though felt bit hack did make override canbecomefirstresponder on uiview return yes , implement uikeyprotocol https://developer.apple.com/library/ios/documentation/uikit/reference/uikeyinput_protocol/reference/reference.html but did nothing on key press. way keyboard stays open keys don't matter.

php - FILTER_VALIDATE_INT unexpected result -

i'm using following code: if(!filter_var($postings['remainingtokens'], filter_validate_int, array('min-range' => 1))){ $this->redirect(array('upgrade', 'id'=>$id)); } when have $postings['remaingtokens'] equal 1 or higher works fine , doesn't execute within if statement. if have negative value though still doesn't execute redirect() . why case? apologies if simple? jonny it spelled min_range not min-range .

python - Resizing child widget by resizing dialog box with mouse -

i using pygtk create dialog box following code: def __init__(self): gtk.dialog.__init__(self, title="add new block", buttons=(gtk.stock_cancel, gtk.response_reject, gtk.stock_ok, gtk.response_ok), ) self.set_size_request(600, 300) vbox = gtk.vbox() self.vbox.pack_start(vbox, true, true, 0) self.block_hbox = gtk.hbox(gtk.false,0) vbox.pack_start(self.block_hbox,false,false,7) self.block_hbox.show() self.block = gtk.label("enter block name") self.block_hbox.pack_start(self.block,false,false,7) self.block.show() self.block_e = gtk.entry() self.block_e.set_size_request(310,-1) self.block_hbox.pack_end(self.block_e,false) self.block_e.show() when try increase size of dialog box using mouse cursor, size of child widget ( gtk.entry ) not change. want increase size increasing dialog box's size. how can this? i got mistake. should have used: self.block_hbox.pack_end(self.block_e,true)

php - My website can post to Facebook Feed of a user although he is logged out from FB -

on page, users can upload pictures , post them facebook wall - should able post on wall if logged in facebook account. check user status piece of code: // check if user connected facebook $facebook = new facebook(array( 'appid' => yii::app()->params['fbappid'], 'secret' => yii::app()->params['fbsecret'], )); $user = $facebook->getuser(); if ($user = $facebook->getuser()) { try { $user_profile = $facebook->api('/me'); echo "you logged in"; } catch (facebookapiexception $e) { $user = null; echo "you logged out"; } } (and code, recommended check if user has not session valid fb login, returns true although no longer logged in @ fb.) now, if log in own page via facebook connect, , log out fb - still logged in on own webpage. thats okay moment. shouldn'

ADT error: Could not create the view: org.eclipse.mylyn.tasks.ui.views.tasks -

does know how fix error? not able view task list, , task list window has error written above/below. could not create view: org.eclipse.mylyn.tasks.ui.views.tasks as far error message "could not create view: org.eclipse.mylyn.tasks.ui.views.tasks" concerned, here's happened in case , how solved it: i had problem eclipse neon version (not luna/mars), i.e. error message appeared in 'task list' view each time started eclipse, if used "-no-activate-task" in command line. the problem because using "customized" environment created previous versions , let neon adapt first time run it. after created new "customized" environment scratch, error disappeared.

php - Only generate string with a Max of X length and Min of X -

i have script generates possible permutations of something. thing is, don't know how make list max of, lets say, 10 characters , minimum of 3 characters. <?php ini_set('memory_limit', '-1'); ini_set('max_execution_time', '0'); $possible = "abcdefghi"; $input = "$possible"; function string_getpermutations($prefix, $characters, &$permutations) { if (count($characters) == 1) $permutations[] = $prefix . array_pop($characters); else { ($i = 0; $i < count($characters); $i++) { $tmp = $characters; unset($tmp[$i]); string_getpermutations($prefix . $characters[$i], array_values($tmp), $permutations); } } } $characters = array(); ($i = 0; $i < strlen($input); $i++) $characters[] = $input[$i]; $permutations = array(); print_r($characters); string_getpermutations("", $characters, $permutations); print_r($permutations);

c# - what can I use to create a datafile for multiple users to access at once, without a server -

i'm not sure if there better way word question, here trying achieve. i trying create simple application installed , used on different computers on network, access same data file. sort of microsoft access. would ado.net dataset trick? or there type of class made this? ...or restricted plain file fileshare? playing around ado, saw, i'm not sure can make stand alone data file sit on mapped network drive. dont use access wont handle more 4 or 5 concurrent users. need database sql server, mysql, oracle. you install 1 of these databases on server , connects server via connection string. without server use http://www.sqlite.org/different.html , here how use c#: is there .net/c# wrapper sqlite? ado.net dataset trick, can use sqldatareaders , sqldataadapters. there many examples on site, ado.net.

ruby on rails - Passing variable param in form via dropdown -

i have form: <tr> <% item.inventory_items.each |product| %> <td> <%= form_tag("/list_items", method: "post") %> <%= hidden_field_tag(:item_id, item.id) %> <%= hidden_field_tag(:inventory_item_id, product.id) %> <%= hidden_field_tag(:shopping_list_id, shoppinglist.first.id) %> <%= submit_tag("#{product.price}", class: "btn btn-primary") %> <% end %> </td> <% end %> </tr> currently hidden_field shopping_list_id being set, can see, shoppinglist.first.id . placeholder make sure form working. want :user able select of lists submit list_item to. i'm unsure of best way that. ideally i'd able have them hover on product price , have drop down of lists select from, whereby form shopping_list_id from. how can best accomplish this? i'm using twitter bootstrap. in advance.

PHP form with MYSQL only posts what I put in. Not the search result -

ok i'm frustrated. cant figure out did wrong. i'm new php , mysql. ok i've got database set up. tables set too. i'm having difficult time php though. have 15 fields want search. on test run php keeps posting put in box. if put in "seth" posts "seth". that's nothing database. put 1 field in php test it. put code in here. curly braces in right places. had trouble indenting on site. the first 1 php.func.inc. <?php include 'db.inc.php'; function search_results($keywords) { $returned_results = array(); $where = ""; $keywords = preg_split('/[\s]+/', $keywords); $total_keywords = count($keywords); foreach ($keywords $key => $keyword) { $where .= " 'keywords' '%$keyword%' "; if ($key != ($total_keywords - 1)) { $where .= " and"; } } $results = "select 'investigator', 'projecttitle'

python - Matching everything after series of hyphens -

i'm trying capture remaining text in file after 3 hyphens @ start of line ( --- ). example: above first set of hyphens should not captured. --- content. should captured. sets of 3 hyphens beyond point should ignored. everything after first set of 3 hyphens should captured. closest i've gotten using regex [^(---)]+$ works slightly. capture after hyphens, if user places hyphens after point instead captures after last hyphen user placed. i using in combination python capture text. if can me sort out regex problem i'd appreciate it. pat = re.compile(r'(?ms)^---(.*)\z') the (?ms) adds multiline , dotall flags. the multiline flag makes ^ match beginning of lines (not beginning of string.) need because --- occurs @ beginning of line, not beginning of string. the dotall flag makes . match character, including newlines. need (.*) can match more 1 line. \z matches end of string (as opposed end of line). for example, import re

c++ - Why does scope resolution fail in presence of decltype? -

it understanding decltype used query type of objects/variables , on. from examples present on wikipedia, such following: int i; decltype(i) x3; // type int i assumed this: class { public: int a, b; }; template<typename t> struct isclass { enum { yes = std::is_class<t>::value }; enum { no = !yes }; }; std::vector<a> v; auto = v.begin(); isclass<decltype(it)::value_type>::yes because after line legal: isclass<std::vector<a>::iterator::value_type>::yes alas wouldn't compile, citing following: error c2039: 'value_type' : not member of ' global namespace''` any ideas why scope resolution made behave way in presence of decltype? p.s: if makes difference i'm using msvc2012 ( without nov ctp) this known bug in visual c++ compiler. has not yet been fixed of visual c++ 2013 preview. can work around issue using std::common_type : isclass<std::common_type<decltype(it)>::type::

php - Find equal columns in different tables in mysql -

there 3 tables, each 1 having approximatelly 60 columns , have find common columns between them. is there way find automatically common columns between 3 different tables? select distinct column_name, count(table_name) common_count information_schema.columns table_name in ('table1', 'table2', 'table3') , table_schema = 'dbname' group table_schema, column_name having common_count > 1

if statement - imacros javascript if else not behaving as it should and more -

okay first off had perfect script, no way run else conditions had parlay in javascript scripts runs not intended. const iterations = 100; // number of times loop (var i=0; i<iterations; i++){ iimset('iteration', ); iimplay('step1'); // part one, grabs varibles , sets up. var string = "error, invalid request."; var result = string.match(/error/i); // result == 'error'; if (result){ iimplay(step1'); // part 2 checks see if successful if not loop step 1 if goes on step 3 } else { iimplay('step2');}} // part three, last step , save extracts. everything triggers not execute should. example. on "part one" call iim step1 set our varibles etc (where worked before javascript) , runs should perfectly. problem comes play on "step two, no matter if detects string or not still fireoff , re-loop shouldent. part 3 when manipulate script make part 3 test it, when complete loops not update

c# - Define a class MyClass<T> or a function MyFunction<T>(T x) where T can only by a type that implements IMyInterface -

i want define class myclass<t> , particular function myfunc<t> , want force t inherit (in way) interface or class. let's call imyinterface . the way knowledge of c# allows me define generic class, check if inherits (see how check if type subtype or type of object? example), , throw exception otherwise. is there way force @ compile-time, rather runtime? generic type constraints: public void myfunc<t>() t : imyinterface { }

php - close a connection early -

i'm attempting ajax call (via jquery) initiate long process. i'd script send response indicating process has started, jquery won't return response until php script done running. i've tried "close" header (below), , output buffering; neither seems work. guesses? or need in jquery? <?php echo( "we'll email done." ); header( "connection: close" ); // stuff take while mail( 'dude@thatplace.com', "okay i'm done", 'yup, done.' ); ?> the following php manual page (incl. user-notes) suggests multiple instructions on how close tcp connection browser without ending php script: connection handling docs supposedly requires bit more sending close header. op confirms: yup, did trick: pointing user-note #71172 (nov 2006) copied here: closing users browser connection whilst keeping php script running has been issue since [php] 4.1, when behaviour of register_shutdown_function()

html - place footer at the bottom of the page -

i want place footer @ bottom of page. contained inside div. problem if use fixed positioning, footer sticks @ bottom not disappear if scroll page. if use absolute or relative positioning footer shows @ middle of page. i want stay @ bottom should not sticky i.e when scroll up, footer must disappear. must shows when scroll down bottom , reached end of page. ps: page contains iframe. html <!doctype html> <html lang="en"> <head> <title>help</title> <meta charset="utf-8"> <link rel="stylesheet" href="style.css"> </head> <body> <div id="header"> <img id="logo" src="images/logo.png" alt="logo"> </div> <div id="menu"> <ul> <li><a href="about.html" target="content">about</a>&l

Javascript Time Display am/pm from Computer (quick tweak) -

just need quick tweak if thats ok. got code web , add am/pm displayed @ end of clock/time. many thanks... <script> function starttime() { var today=new date(); var h=today.gethours(); var m=today.getminutes(); var s=today.getseconds(); // add 0 in front of numbers<10 m=checktime(m); s=checktime(s); document.getelementbyid('txt').innerhtml=h+":"+m+":"+s; t=settimeout(function(){starttime()},500); } function checktime(i) { if (i<10) { i="0" + i; } return i; } </script> <div id="txt"></div> or, if want displayed in 12-hour format: <script type="text/javascript"> function starttime() { var today=new date(); var h=today.gethours(); var m=today.getminutes(); var s=today.getseconds(); // add 0 in front of numbers<10 m=checktime(m); s=checktime(s); var hd=h; document.getelementbyid('txt').innerhtml=(hd=0?"12":hd>12?hd-12:hd)+":"+m+":

javascript - Slowly scroll the content of a div on hover and stop on mouseoff -

please take @ website i'm trying implement 2 arrows on top , bottom of gallery when people mouse on arrows, content scroll top , bottom respectively. here code i'm using scrolls content down when hover on bottom arrow. there 2 issues it: i want scrolling stop when user mouses off hopefully not display arrow(s) if there no more content left scroll if ( $("body").hasclass('projects') ) { $("#jig1").height($(document).height() - 187); $("#scroll-to-bottom").hover( function () { $("#jig1").animate({ scrolltop: $(document).height() }, 10000); }, function () { } ); } can offer improved solution? answer seccond question. add inner wrapper divs blocks html should this <div id="jig1"> <div id="jig1inner"> ... here put rest of code if ($("body").hasclass('projects')) { $("#jig1")

php cannot execute procedure sql server -

i have query this, declare @tmpspj table(kd_rek_1 tinyint, kd_rek_2 tinyint, kd_rek_3 tinyint, kd_rek_4 tinyint, kd_rek_5 tinyint, anggaran money, gaji_l money, gaji_i money, ls_l money, ls_i money, up_l money, up_i money) declare @peny_spj bit declare @tahun varchar(4), @kd_urusan varchar(3), @kd_bidang varchar(3), @kd_unit varchar(3), @kd_sub varchar(3), @bulan tinyint set @kd_urusan = '1' set @kd_bidang = '2' set @kd_unit = '1' set @kd_sub = '0' set @tahun = '2013' set @bulan = '2' if isnull(@kd_urusan, '') = '' set @kd_urusan = '%' if isnull(@kd_bidang, '') = '' set @kd_bidang = '%' if isnull(@kd_unit, '') = '' set @kd_unit = '%' if isnull(@kd_sub, '') = '' set @kd_sub = '%' select @peny_spj = isnull(peny_spj, 0) ref_setting tahun = @tahun insert @tmpspj select a.