Posts

Showing posts from September, 2014

javascript - Twitter Bootstrap Width Auto Issue -

i'm working on mobile version of website allows user view either navbar or content area @ 1 time. found , modified jsfiddle i'd like... http://jsfiddle.net/sfgab/2/ notice 100% width, if click link , open nav again, smaller (width: auto). due part of twitter bootstrap's collapse javascript: reset: function (size) { var dimension = this.dimension() this.$element .removeclass('collapse') [dimension](size || 'auto') [0].offsetwidth this.$element[size !== null ? 'addclass' : 'removeclass']('collapse') return } i assume can swap out 'auto' '100%', doesn't seem ideal solution. have suggestion? so ended doing not using bootstrap's code this... <button type="button" class="btn btn-navbar" data-toggle="collapse" data-target="#menu"> i used javascript code , css so: #nav.in { width:0; } #nav.out { width:50%; } #nav.

selector - Child of a parent of $(this) in jQuery -

i have following html: <div class="container"> <img class="imgtab" src="http://cloudsmaker.com/hipsterwall/img/salto-al-norte.jpg"> <p class="textab">paragraph text</p> </div> with following javascript: $(document).ready(function () { //initial conditions $(".container > img").width("200px"); $(".container > img").height("116px"); $(".container > p").hide(); //on click $(".container > img").toggle(function () { //fired first time $(this).animate({ width: "400px", height: "232px" }); //$(**selectorneeded**).show();//this need show text }, function () { // fired second time $(this).animate({ width: "200px", height: "116px" }); //$(**selectorneeded**).hide();//this nee

css - space between divs in html5 document -

my question simple. how can remove space between div tags? this html document: <div class="nav"> <div>option 1</div> <div>option 2</div> <div>option 3</div> <div>option 4</div> </div> and css div.nav { border:1px solid; } div.nav > div { display:inline-block; background-color: #ccc; padding: 10px; margin:0 } here fiddle can see http://jsfiddle.net/dmsf/7szjw/3/ the doctime html5 try this <div class="nav"> <div>option 1</div><div>option 2</div><div>option 3</div><div>option 4</div> </div>

sql - JPA, SQlite no such table: SEQUENCE -

i have problem jpa , sqlite. i have created entity table. generated entity looks like: @entity @table(name="sqlitetesttable") public class test implements serializable { private static final long serialversionuid = 1l; @id @generatedvalue(strategy=generationtype.identity) @column(name="id") private int id; @column(name="name") private string name; public test() { } ------ } when try persist few test objects following error: (i have executed same code on mysql without problems) exception in thread "main" local exception stack: exception [eclipselink-4002] (eclipse persistence services - 2.4.1.v20121003-ad44345): org.eclipse.persistence.exceptions.databaseexception internal exception: java.sql.sqlexception: no such table: sequence error code: 0 call: update sequence set seq_count = seq_count + ? seq_name = ? bind => [50, seq_ge

concurrency - When could Futures be more appropriate than Actors (or vice versa) in Scala? -

suppose need run few concurrent tasks. i can wrap each task in future , wait completion. alternatively can create actor each task. each actor execute task (e.g. upon receiving "start" message) , send result back. i wonder when should use former (with future s) , latter (with actor s) approach , why future approach considered better case described above. because syntactically simpler. val tasks: seq[() => t] = ??? val futures = tasks map { t => future { t() } } val results: future[seq[t]] = future.sequence(futures) the results future can wait on using await.result or can map further/use in for-comprehension or install callbacks on it. compare instantiating actors, sending messages them, coding receive blocks, receiving responses them , shutting them down -- require more boilerplate.

c++ - Convert std::wstring to WCHAR* -

i have no idea how convert std::wstring wchar* std::wstring wstrproctosearch; wchar * wpproctosearch = null; std::wcin >> wstrproctosearch; // input std::wstring // need convert wstring wchar* does know how accomplish this? if want convert std::wstring const wchar* (i.e. returned pointer gives read-only access string content), calling std::wstring::c_str() method fine: std::wstring wstrproctosearch; std::wcin >> wstrproctosearch; // input std::wstring // convert const wchar* (read-only access) const wchar * wpszproctosearch = wstrproctosearch.c_str(); instead, if want modify std::wstring 's content, things different. can use &wstr[0] (where wstr non-empty instance of std::wstring ) access content of std::wstring (starting address of first characters, , noting characters stored contiguously in memory), must pay attention not overrun string's pre-allocated memory. in general, if have std::wstring of length l , can access chara

c# - using Json in Portable Class Library -

i'm attempting load data in portable class library. data in json format. need parse , work information. unfortunately, doesn't appear system.json available. @ same time, tried include json.net nuget package without luck. how 1 work json data in portable class library? thank you json.net pcl available - if can't find official nuget version, old version in mvvmcross json plugin package - or in mvvmcross binaries git repo.

c# - Access UserProfile from a controller MVC 4 -

new this: have model character has userprofile property, character can assiciated userprofile entry. make userprofile foreign key character. character model: public class character { public int id { get; set; } public virtual userprofile user { get; set; } public string name { get; set; } ... } (i made userprofile property virtual because of post, not sure if should stay) when creating new character want set user property of character object of current web-user making request. example here process user take make character: login/create user account site click 'create character' [httppost] public actionresult create(character character) { if (modelstate.isvalid) { character.user = ??? db.characters.add(character); db.savechanges(); ... } problem not know how access userprofile table controller. typically access table create object of dbcontext userprofile table using default mvc 4 context while other objects of

angularjs - Adding location to Google Map on page load with Angular UI -

thanks @ajoslin have working google map using angularui , angularjs. unfortunately there 2 things can't figure out how may have google map api , lack of understanding of. when map loads, have location wish load marker on it. how do that? i wish set ng-click="mymap.panto(marker.getposition()) not new marker initial location, marker have since i'm removing add marker functionality out, once can figure 1 out. here working jsfiddle http://jsfiddle.net/jorgecas99/xmw6u/ i think should achievable setting tilesloaded event, didnt manage way, ended using simple "trick", watching mymap appear. $scope.$watch('mymap', function(){ $scope.sethome(); }); $scope.sethome = function() { $scope.homemarker = new google.maps.marker({ map: $scope.mymap, position: $scope.mapoptions.center }); }

android - How to force a content provider to reset when manually deleting database -

in app have contentprovider attached table in database cursorloader fills listview in 1 of activities. table filled empty default , gets filled user input data. want allow user delete of stored data , i'm deleting entire database when option selected. database recreated in it's default state when user starts using app again, first time used app. my issue when delete database, contentprovider doesn't detect database deleted , when go listview activity, list still there. i'm making app reload listview activity instead of resuming memory , list still there though database empty. way can contentprovider reload kill app in system settings , open again. is there way forcefully restart contentprovider or tell data has been updated outside of contentprovider class itself? you can use delete method of content provider without defining selection: context.getcontentresolver().delete(yourprovider.content_uri, null, null);

c - Compiling libjpeg on Windows using cygwin? -

which best way compile libjpeg on windows machine? should use microsoft visual studio or can use else cygwin? note: when use cygwin , copy makefile.vc makefile , jconfig.vc jconfig.h , run sample code: http://www.cim.mcgill.ca/~junaed/code/libjpeg_sample.tar.gz then compiler produces following errors: $ gcc main.c c:\cygwin\tmp\ccwchyey.o:main.c:(.text+0x5a): undefined reference `jpeg_std_error' c:\cygwin\tmp\ccwchyey.o:main.c:(.text+0x7e): undefined reference `jpeg_createdecompress' c:\cygwin\tmp\ccwchyey.o:main.c:(.text+0x93): undefined reference `jpeg_stdio_src' c:\cygwin\tmp\ccwchyey.o:main.c:(.text+0xa9): undefined reference `jpeg_read_header' c:\cygwin\tmp\ccwchyey.o:main.c:(.text+0xb7): undefined reference `jpeg_start_decompress' c:\cygwin\tmp\ccwchyey.o:main.c:(.text+0x11b): undefined reference `jpeg_read_scanlines' c:\cygwin\tmp\ccwchyey.o:main.c:(.text+0x178): undefined reference `jpeg_finish_decompress' c:\cygwin\tmp\ccwchyey.o:main.c

Java: Cannot find symbol: variable Objects -

i generated methods hashcode() , equals(object obj) netbeans insercode. in netbeans can compile without errors, when compile on server javac: bangserver/login.java:3: cannot find symbol symbol : class objects location: package java.util import java.util.objects; ^ and other errors objects... public int hashcode() { int hash = 5; hash = 47 * hash + objects.hashcode(this.password); return hash; } what guys think should problem can't find java.util.objects ? it looks you're compiling java verson older java 7, since java.util.objects added in java 7.

javascript - jQuery select fails to find form by ID, but works when selecting all forms -

Image
this question has answer here: why doesn't jquery selector period work 9 answers i attempting select form id using jquery. currently, code fails find form id. however, using jquery select forms on page select form , shows appropriate id. idea have why happening perhaps form's id using invalid characters. console.log("forms:", $('form')); console.log("orderdetailsform:", $('form#cablesolve.web.models.workflow.existingorderdetailsmodel')); the '.' making jquery think looking id cablesolve sorts of classes

firewall - Regex for Proxy Server to add edufilter to youtube requests -

i working on internet filtering. proprietary system suppose (comsifter), based on dan's guardian, there few people around here can benefit answer question. i pretty sure regex url modify rules want use should similar these. formatting might different other programs, think makes sense doing. finds left, , replaces right redirect believe. "https://www(\.google\..*)"->"https://nosslsearch\1" "(http://[^/]*www\.google\..*\?.*)"->"\1&safe=vss" "(http://[^/]*bing\..*\?.*)"->"\1&adlt=strict" "(http://[^/]*yahoo\..*\?.*)"->"\1&vm=r" "(http://[^/]*youtube\..*\?.*$)"->"\1&edufilter=wql9minebtaq3b9htraoia" "(http://[^/]*youtube\.[^?]*$)"->"http://youtube.com/?edufilter=wql9minebtaq3b9htraoia" "https://[^/]*youtube\..*"->"http://youtube.com/education" however, can't quite youtube ones work, think rest now.

jQuery Week Calendar - side by side display of conflicting events? -

i"m using jquery week calendar ( https://github.com/robmonie/jquery-week-calendar/wiki ) in order display large number of different events. (many) of these events overlap. is possible show events side-by-side (similar how google's calendar web app it) instead of having them overlap? yes , easy implement. when calling calendar in jquery , setting of parameters such timeslotsperhour etc. add in: overlapeventsseparate : true, after have set allowcaleventoverlap , there go.

php - filesize stat failed -

i have php script running, loops through files in specified directory. returns name, filesize, modified_date etc. each file finds. script returns info of files correctly, except ones have chinese or other symbols in it. famous filesize stat failed error (warning). how solve this, without changing filenames? i provide code if needed. i've encountered before; file system encoding difficult , hard predict, works me: stat(iconv('utf-8', 'iso-8859-1', $filename)); it converts filename utf8 iso8859-1 , tries. this tricky though, @ page juicy dialog in post comments: http://www.rooftopsolutions.nl/blog/filesystem-encoding-and-php

r - Add variable to melt function -

here input, question below: targets <- read.csv("mir155aicda.csv", row.names=1, sep="", header=t) head(targets) t0h t0.25h t0.5h t1h t2h t3h t6h t12h t24h t48h c0h c0.25h c0.5h c1h c2h aicda 785 1150 707 513 1265 3268 8294 8625 7387 4397 677 911 673 737 1782 mmu-mir-155-3p 622 548 558 1213 1195 1172 1115 1883 3257 1900 499 562 584 543 580 targets.m <- melt(targets) > head(targets.m) variable value 1 t0h 9.616549 2 t0h 9.280771 3 t0.25h 10.167418 4 t0.25h 9.098032 5 t0.5h 9.465566 6 t0.5h 9.124121 question: how add aicda , mmu-mir-155-2p variable? i want this: id variable value 1 aicda t0h 9.616549 2 mmu-mir-155-3p t0h 9.280771 3 aicda t0.25h 10.167418 4 mmu-mir-155-3p t0.25h 9.098032 5 aicda t0.5h 9.465566 6 mmu-mir-155-3p t0.5h 9.

java - Why does removing an element from a list throw ConcurrentModificationException? -

this question has answer here: concurrent modification exception 9 answers my program throws concurrentmodificationexception when run following piece of code. through research found element in list cannot added or removed when in iterator loop. do remove element in list<bean> ? for (iterator<entry<string, list<bean>>> iterator = datamap.entryset().iterator(); iterator.hasnext();) { entry<string, list<bean>> entry = (entry<string, list<bean>>)iterator.next(); list<bean> datewisevalues = (list<bean>) entry.getvalue(); int j = 0; (bean statbean : datewisevalues) { (int = 0; < commonelements.size(); i++) { if(statbean.getdate().equalsignorecase(commonelements.get(i))) { //remove bean entry.getvalue().remove(j); } }

ruby - When to Use Rake Tasks in Rails -

i'm confused on whether rails way place code in rake task or in model. i have code run background job send email user if 1 of friends had activity day i'm using whenever gem schedule execution of method/task allows me run code either model or rake task can me newbie question of if rails way put background job-only code in model or rake task? this nothing rails way object oriented programming. should place behavior @ class can use form every place in app. if place @ rake task have behavior there. , kind of rake task should know how should model or other class. example if want use resque in future changes code easier if have inside of class , not locked inside rake task.

javascript - Multiple else if with indexOf -

i have following code: var aaaa = exploded[1]; if (aaaa.indexof("bbbb")>=0) { //do here } everything works great, when add: else if (aaaa.indexof("cccc")>=0) { //do else } else if (aaaa.indexof("dddd")>=0) { //do else 2 } else if (aaaa.indexof("eeee")>=0) { //do else 3 } i message "aaaa undefined" , code wont run. how can fix this? thanks edit: commenting curly braces mistake when wrote here in stacoverflow, has nothing issue. solved issue removing lost curly brace inside first else if. problem solved! works fine: var aaaa = "bbbb"; if (aaaa.indexof("bbbb")>=0) { alert('aa') ; } else if (aaaa.indexof("cccc")>=0) { alert('cc'); } else if (aaaa.indexof("dddd")>=0) { alert('dd'); } else if (aaaa.indexof("eeee")>=0) { alert('ee'); }

Run Bash from Java Program to Capture Webcam Image on Raspberry Pi -

on raspberry pi, can capture , save images logitech pro 9000 usb webcam lxterminal following bash line: fswebcam -d /dev/video0 /home/pi/image.jpg i want write java program runs bash line above because simplest way capture , save image. far, have: import java.io.*; public class grabnsave { public static void main(string[] args) throws ioexception { runtime.getruntime().exec("/bin/bash -c fswebcam -d /dev/video0 /home/pi/image.jpg"); } } it's not working. no error messages. please help! first, need install fswebcam .... sudo apt-get install fswebcam then, in java program, need run following : runtime.getruntime().exec("fswebcam -d /dev/video0 /home/username/desktop/test.jpg"); worked me, you! =) i had same problem @ first, way.. =) luck!

java - Batch inserts in JDBC - how much slower will a single transaction be? -

i found out jdbc's addbatch operation, if given "insert mytable (id, name) values (?, ?)" create this: begin transaction insert mytable (id, name) values (1, "a"); insert mytable (id, name) values (2, "b"); ... end transaction compared statement this: "insert mytable (id, name) values (1, "a"), (2, "b"), .. " , how slower massive transaction be? difference in i/o matter significantly? pgjdbc batching not fast multi-valued insert , is more convenient. by far efficient option use copy command via pgjdbc's support copy . a second option open transaction, batches of multi-valued inserts of (say) 10 rows per insert, followed set of single-row inserts make difference , commit. pgjdbc batching should not faster opening transaction, preparing statement, looping on data sending each row prepared statement, doing explicit commit. don't think has multiple statements in-flight @ once in batch, i'

java - Getting The ArrayList To Keep Each Account Balance And Number -

i have completed program stuck on getting each account balance for example if enter first savings account balance work fine when open savings account account balance of first account show the last account balance entered know have correct error thanks package object_1_programs; import java.util.date; /** * * */ public abstract class account { //instance variables decleared private string c_name; private string acc_num; private double acc_balance; java.util.arraylist transactions=new java.util.arraylist(); //default constructor public account(){ } //constructor public account(string c_name,string acc_num,double acc_balance){ this.c_name=c_name; this.acc_num=acc_num; this.acc_balance=acc_balance; } //getters , setter method public string setname(){ return this.c_name; } public string getcname(){ return this.c_name; } public string setaccnum(string acc_num

java - Jackson Json with nested parametric classes -

listing: import java.util.list; public class listing<t> { list<thing<t>> children; public list<thing<t>> getchildren() { return children; } public void setchildren(list<thing<t>> children) { this.children = children; } } thing: public class thing<t> { private string type; private t data; public t getdata() { return data; } public void setdata(t data) { this.data = data; } public string gettype() { return type; } public void settype(string type) { this.type = type; } } link: public class link { private string author; public string getauthor() { return author; } public void setauthor(string author) { this.author = author; } } and here's example of serialization , deserialization... public static void main(string[] args) throws ioexception { link link1 = new link()

android - Referring to multiple string resources -

is there way refer multiple resources inside another? it's easier show sample code. <resources> <string name="app_name">appname</string> <string name="sep">--</string> <string name="action">myaction</string> <string name="action_title">@string/app_name @string/sep @string/action</string> </resources> so @string/action_title should appname -- myaction however, when use seems r.java chokes , doesn't built. missing or impossible? edit using label broadcastreceivers in androidmanifest.xml doing in code doesn't seem option. it possible long using single reference like <string name="app_name">appname</string> <string name="sep">@string/appname</string> but can not multiple reference wanted nor following <string name="app_name">appname</string> <string nam

web - Leverage browser catching for google plus button and analytics (2) -

this code put in htaccess file not working. maybe missing something? or doing wrong? if can, please. expiresactive on expiresbytype image/jpg "access plus 1 month" expiresbytype image/jpeg "access plus 1 month" expiresbytype image/gif "access plus 1 month" expiresbytype image/png "access plus 1 month" expiresbytype text/css "access plus 1 month" expiresbytype application/pdf "access plus 1 month" expiresbytype text/x-javascript "access plus 1 month" expiresbytype application/x-shockwave-flash "access plus 1 month" expiresbytype image/x-icon "access plus 1 year" expiresdefault "access plus 1 week" but, after adding google plus 1 button site , adding google analytics these 2 sugestions on gtmetrix.com the following cacheable resources have short freshness lifetime. specify expiration @ least 1 week in future following resources: https://apis.google.com/js/plusone.js (30 minute

java.lang type error what should i do? -

in system running apache_tomcat_6.0 have setup files of apache_tomcat_6.0.18 in e drive , take startup.bat file e drive error when execuiting following code ssssssssssss : java.lang.processimpl@19e3cd51 e:/nymble/nymble/code/apache-tomcat-6.0.18/bin/startup.bat returned 0 private void downloadactionperformed(java.awt.event.actionevent evt) { runtime r = runtime.getruntime(); process p = null; string cmd = "e:/nymble/nymble/code/apache-tomcat-6.0.18/bin/startup.bat"; try { p = r.exec(cmd); p.waitfor(); } catch (exception e) { system.out.println("error executing " + cmd); } system.out.println("ssssssssssss : "+p); system.out.println(cmd + " returned "+ p.exitvalue()); }

java - Unable to resolve target 'android-15' until the SDK is loaded -

i'm quite new in eclipse. i download coding error below: the project not build since build path incomplete. cannot find class java.lang.object. fix build path try building project -the type java.lang.object cannot resolved. indirectly referenced required .class files unable resolve target 'android-15' unable resolve target 'android-15' until sdk loaded. any idea how solved it? in eclipse go window --> android sdk manager , in sdk manager check whether have installed sdk api level 15 or not. , right click on project go properties there android tab on left hand side pannel. click on show project build target. make higher version.

java - How do I get out of the showUsage() method in the main method? -

every time run program, goes straight showusage method in if statement. why that? how can continue program without getting stuck in showusage method? want able run program can input data txt file unfortunately, i'm getting stuck in showusage() method. public class datagenerator { public static void main(string[] args) { if ( args.length != 1) { showusage(); system.exit(0); } string target = args[0]; switch (target) { case "trans" : generatetransactionrecords(); break; case "master" : generateaccountrecords(); break; default : showusage(); } } private static void showusage() { system.out.println("usage: datagenerator trans|master"); system.out.println(" trans generate trans.txt representing transcations data"); system.out.

php - How to change the after login,index page of wordpress? -

i want change default index page loaded after login in worpress ? want set new page index page. you can use peter's login redirect plugin achieve functionality. http://wordpress.org/extend/plugins/peters-login-redirect/

How to interchange the table cells using jquery ui using drag and drop -

i want interchange columns table on drag , drop. <table> <tr> <td class='1'> first </td> <td class='2'> second </td> </tr> <tr> <td class='3'> third </td> <td class='4'> fourth </td> </tr> now can use draggable function $(".1").draggable(); if drag class='1' td class='4' td both td's interchange. how can able jqueryui i think need sortable functionality in jqueryui http://jqueryui.com/sortable/ example extracted api: http://jsfiddle.net/d8wgv/

jquery timing with ajax call and html() -

i loading list div via perl in ajax call. once list loaded triggering click on first row: success: function(data) { $('#newslist').html(data); $("#newslist .editrow").first().trigger('click'); }, but problem timing ... in code above nothing happens. html() synchronous operation guessed wasn't loaded in time trigger it's job. to test wrapped trigger line in settimeout of 1000 worked fine. ie first row clicked , associated click worked should. as there not callback html(), correct way ... timeout not correct way of course. try using $("#newslist .editrow").delay(1000).first().trigger('click');

google chrome - javascript check if image is in browser cache -

i have following code check if external image cached or not <script type="text/javascript"> function cached(url){ var test = document.createelement("img"); test.src = url; return test.complete || test.width+test.height > 0; } var base_url = "http://www.google.com/images/srpr/nav_logo80.png" alert("expected: true or false\n" + cached(base_url) + "\n\nexpected: false (cache-busting enabled)\n" + cached(base_url + "?" + new date().gettime())); </script> i following result false false, true false on firefox , ie (which assume first fires false false,then after grabs image, fires true,false, in chrome false, false always any reason why? the answer on this question seems work on chrome. function cached(url){ var test = document.createelement("img"); test.src = url; return test.complete || test.width+test.h

Python Ordered Dictionary to regular Dictionary -

i have like [('first', 1), ('second', 2), ('third', 3)] and want built in function make like {'first': 1, 'second': 2, 'third': 3} is aware of built-in python function provides instead of having loop handle it? needs work python >= 2.6 dict can take list of tuples , convert them key-value pairs. >>> lst = [('first', 1), ('second', 2), ('third', 3)] >>> dict(lst) {'second': 2, 'third': 3, 'first': 1}

Rails 3 simple custom post action for form -

i'm bit stuck actionview::missingtemplate error on form controller action doesn't require view since it's passing off params data controller , controller post api request. # newsletter controller def index end def subscribe gibbon.list_subscribe({:id => "my-list-id", :email_address => params[:email]}) end in routes: # routes match "/subscribe", to: "newsletter#subscribe", :via => :post view form lives # newsletter/index.html.erb <%= form_tag subscribe_path, class: "form", remote: true %> <%= text_field_tag :email, nil, :class => 'email', :type=>"email", :placeholder => 'sign newsletter' %> <%= submit_tag "go", class: "submit-button"%> <% end %> from newsletter index page there form , want send request of user's email address subscribe action error: started post "/subscribe" 127.0.0.1 @ 2013-04-20 18:01:

Converting SVG paths with holes to extruded shapes in three.js -

Image
i have shape consists of 4 polygons: 2 non-holes , 2 holes. example. in reality there can shape consists of 50 polygons, of 20 non-holes , 30 holes. in svg path polygon can represented combining moveto:s , lineto:s. every sub-polygon (hole or non-hole) in path string starts moveto-command , ends z (end) command , non-holes have winding order cw , holes ccw. easy , intuitive. the shape in svg represented way ( http://jsbin.com/osoxev/1/edit ): <path d="m305.08,241.97 l306,251.51 l308.18,256.39 l311.72,259.09 l317.31,260.01 l324.71,259.01 l332.45,255.86 l335.57,257.53 l337.6,260.44 l336.94,262.33 l328.27,268.74 l317.89,273.41 l307.94,275.49 l296.26,275.23 l286.64,272.99 l279.78,269.31 l274.14,263.55 l271.65,260.21 l269.2,261.06 l254.83,268.51 l242.11,272.97 l227.59,275.23 l209.91,275.48 l197.47,273.63 l187.91,270.13 l180.48,265.09 l175.32,258.88 l172.2,251.44 l171.1,242.23 l172.24,233.63 l175.49,226.24 l181,219.54 l189.42,213.3 l201.36,207.73 l217.23,203.25 l238.28,200.1

lisp - Turn-off debugger in Emacs SLIME -

according this question , can customize variable *debugger-hook* falls toplevel (in repl) instead of debugger. i've added line ~/.sbclrc , it's fine when start sbcl command line. (setf *debugger-hook* #'(lambda (c h) (declare (ignore h)) (print c) (abort))) but, above doesn't work emacs slime. whenever compile/load file (c-c c-k), still invokes debugger (with options abort calculation, restart, enter new value etc.). how can ask slime print error message , throw me toplevel? yea, it's sbcl , same ~/.sbclrc before. looks slime doesn't respect user's setting of *debugger-hook* . as per http://common-lisp.net/project/slime/doc/html/other-configurables.html setting swank:*global-debugger* nil in ~/.swank.lisp file should force slime not replace *debugger-hook* swank:swank-debugger-hook (which shows list of restarts etc.), somehow doesn't work me, i.e. swank:*global-debugger* nil anyway *debugger-hook* replaced slime. maybe you'll

sql server 2008 case statement in where clause not working -

i have 3 table, documents , sr , events in documents saving documents related sr , events. and want show documents in 1 page. so using select query select * documents d, sr s, events e d.relationid = ( case d.documenttype when 'sr' s.srid else 'e.eventid end) but it's not working. my document table structure : documentid int, documenttype nvarchar(50), relationid int, document image, docdate date can please point me mistake ? i want select documents related info. means if sr document sr details should display otherwise events. there 2 types of documents right now. what should select query ? you can join using left join , select d.*, coalesce(s.col1, e.col1) col1, coalesce(s.col2, e.col2) col2, coalesce(s.col3, e.col3) col3, coalesce(s.col4, e.col4) col4 documents d left join sr s on d.relationid = d.srid left join events e on d.relationid = e.eventid w

Poco / zlib: error LNK2019 unresolved external "_gzopen" -

i trying use zlib functions while working poco c++ library. linking zlib library directly not work, because poco links , several duplicates while linking. removed zlib.lib libraries list , used poco version only. because zlib.h part of poco, compiling works perfectly, linking results in following error error lnk2019 unresolved external "_gzopen" so can switch between duplicate , unresolved . can me out? on windows, defining zlib_dll should force export of native zlib interface. optionally, poco inflatingstream , deflatingstream wrap zlib functionality. word of warning: these std streams derivatives , there may performance penalty.

database - Auto increment an ID with a string prefix in oracle sql? -

i have created following table , wish have userid auto-increment whenever there row added database. id formatted 000001 example below, since there few tables , ideal give each id string prefix: userid ---------- user000001 user000002 user000003 create table usertable ( userid varchar(20), username varchar(250) not null, firstname varchar(250) not null, lastname varchar(250) not null, constraint pkuserid primary key (userid), constraint uniusername unique (username) ); you have use combination of trigger , sequence shown in code below: create sequence create sequence usertable_seq start 1 increment 1 nocache nocycle; / create or replace trigger usertable_trigger before insert on usertable each row begin select 'user' || to_char(usertable_seq.nextval, '000099') :new.userid dual; end; /

java - Saving database attributes via sql-lite -

in program,i provided users facility of designing own database. have sucessfully achived have tables , values saved in class objects. now want save in sql lite/create output xml file of database. public class table { private arraylist<column> columns; private string name; private static int count=0; public table() { columns = new arraylist<column>(); name=new string(); this.name="table"+count; count++; } public void addcolumn(column column) { for(column c: columns) { if(c.getname().equals(column.getname())){return;} } columns.add(column); } public void savetofile() throws ioexception { filewriter fw = new filewriter("c:/users/ashad/desktop/text.txt", true); bufferedwriter bw = new bufferedwriter(fw); bw.write("\r\n"); bw.write(this.name); bw.write("\r\n"); for(column c: columns) { bw.write("\r\n"); bw.write(c.getname()+" ");

postgresql - Create a new function from an existing function in Postgres? -

i have created function function_1() in postgres. want create similar function function_2() , copy content of function_1() . any postgres command line can that? so far used copy&paste method in command line create function_2() (need change function name "function_2" after paste) if using gui pgadmin , can select function in object browser , open reverse engineered sql script in sql editor window. there dedicated item in options automate it: options - query tool - query editor - copy sql main window query tool

jquerycsvtotable + tablesorter: hold the display untill everything is loaded? -

i use tablesorter in combination jquerycsvtotable. works fine, but... there's lag between moment when table loaded , moment when tablesorter shown makes data appear without formatting on screen. time varies on amount of data, between 2 , 5 seconds. is there way show "loading" gif or nothing untill process completed avoid showing ugly data? thanks! ps: don't mean time tablesorter takes re-order rows when click on header cell, know arranged optional processing gifs shown header... edit: please find below code. <!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"> <head> <link rel="stylesheet" type="text/css" href="/js/ts/css/theme.default.css"> <script type="text/javascript" src="http://code.jquery.com/jquery-1.9.1.js"></script> <script type

How do I integrate solr to a JSF application? -

i want use apache solr search engine jsf application. have installed solr standalone application deployed glassfish. , know how configure solrconfig.xml , schema.xml use in application. don't know how how make java bean class (or other approach) , how recall in jsf page. after 2 days of searching web couldn't find tutorial or example neither resource. or providing live example or tutorial highly appreciated since i've been working on whole week. the following articles param's blog helpful me. helped me understand whole idea. solrj code , usage example , configure apache solr 1.4 mysql

android - Get names of all friends from Twitter API -

i want names of friends in efficient way within api limit of twitter. know can use method: ids ids = twitter.getfriendsids(cursor); but method gives ids , need iterate on list, not efficient @ , exceed api call limit. refer this , this .. you. check twitter counter api also

hyperlink - Jquery animation not working after clicking link -

i'm starting out jquery , love i've got problem can't wrap head around. i've implemented plugin purchased which's creates grid of thumbs can filter on attributes. (trough li class) in addition wrote little piece of code expands div on click. both works until menu used (to filter out attribute) understand may sound bit vague until see here's link: http://media-surfer.nl/test if need code pasted here since it's quite lot figured best keep overview , visit link. i life of me can't figure out, appreciated! ton in advance :) here's code wrote: <!-- collapse expand jquery --> <script type="text/javascript"> $(document).ready(function(){ $(".inhoud").hide(); $(".show_hide").show(); $('.show_hide').click(function(event) { $(".inhoud").parent().animate({ width: '160' }, 500, function() { // a

C++ overloaded operator with reverse order of associativity -

it hard come title... (i'm not native english speaker.) struct { int value; operator+(int i) const { a; a.value=value+i; return a; }; }; int main(){ a; a.value=2; a=a+2; return 0; } this code compiles/works expected, when change a=a+2 a=2+a, won't compile anymore. gcc gives me error: no match ”operator+” in ”2 + a” is there way somehow make 2+a work a+2? you need free function, defined after class struct { // ... }; operator+(int i, const a& a) { return a+i; // assuming commutativity }; also, might consider defining a& operator+=(int i); in a implement both versions of operator+ free functions. might interested in boost.operators or other helpers simplify a , see profile 2 options.

mysql - Times out by 1 hour in database -

i've taken on development of new system previous developer, , honest it's mess. all diary items ahead 1 hour, format saved in 1355385600. fields responsible time start_time , end_time. i need way bulk update of entries in database , remove hour them. do guys have ideas on how can achieve this? cheers note: should have mentioned default timezone set correctly 'europe/london' , when add new diary entry times correct. need though, find way bulk update current entries in database go 1 hour. possible? you need set timezone. for sites, set timezone date_default_timezone_set('europe/berlin') , , when insert datetime in database, use date('y/m/d h:i:s') . for yours, instead of date('y/m/d h:i:s') , should strtotime(date('y/m/d h:i:s'))

cuda - what happens when multiple kernels are sent to the device to be executed? -

suppose have send 2 consecutive kernel calls device. wait complete first 1 or executed them concurrently? if executed in parallel, intersect each other instance memory access? paradigm used such case in cuda? two consecutive kernel launches same cuda device run concurrently if : they launched same cuda context. they executed on different cuda streams. the device supports concurrency (compute 2.0 , later). there sufficient resources (registers, shared memory, thread blocks) support thread blocks both kernels simultaneously. for more information, see this section in cuda c programming guide . as sgar91 commented, if these kernels share global memory, programmer's responsibility write correctly synchronized program avoid race conditions. if 2 kernels read same memory, there can no race condition.

sql server - SQL select -one to many joins want to have the manys -

i have 2 tables, tbl_parent (parentid, parentname) , tbl_children (parentid,child_name) parent can have 0 many children what want query give me list of parent , children in single row per parent. for example parent1 john,mary parent2 jane,steve,jana and number of rows total number of parents here answer need. not accepted answer question, right answer. https://stackoverflow.com/a/177153/2324286

MS Sync Framework: synchronize 1 client DB with 2 server databases -

working on connected application on windows mobile devices. application stores data locally in sql ce database synced mssql db using ms sync framework (via web service). now it's necessary sync mobile db 2 different server databases. i.e. sql ce database has tables a,b,c. tables , b should synced tables , b on serverdatabase1, , table c should synced table c on serverdatabase2. i'm thinking of creating second set of sync objects (syncagent , syncprovider) used syncing second database. wondering if there's other more convenient way this. that should work long you're synching same table same server. i.e., table c synched table c in serverdatabase2. the sync provider you're using has table contains "anchors" every table sync. anchors last sent , last received timestamps (if you're using timestamps). there's 1 row each table, cannot keep track of sync status of each table against multiple sync partners. a received anchor server dif

javascript - How to create new tag element in Angular.js -

i want create new element in angular.js <link url="http://google.com">google</link> that converted <a> tag, how can this? the code far: var app = angular.module('app', []); app.directive('link', function() { return { restrict: 'e', transclude: true, replace: true, scope: false, template: '<a href="" ng-transclude></a>'; } }); but render google after link , don't know how url. you can in linking function. directive this: app.directive('link', function() { return { restrict: 'e', transclude: true, replace: true, scope: false, template: '<a href="{{url}}" ng-transclude></a>', link: function(scope, element, attrs) { scope.url = attrs.url; } } }); if you're ok creating isolated scope directive, can this: a

WPF does not render Windows OpenType font name -

Image
i cannot figure out how determine how render specific opentype font correctly in wpf (.net 4.5 / vs2012 / windows 8). have font installed on computer called "dinpro-blackitalic". the file name is: dinpro-blackitalic.otf windows reports font name is: dinpro-blackitalic in wpf, simple, this: <textblock text="this sample sentence in dinpro-blackitalic" fontfamily="dinpro-blackitalic" fontsize="24" /> or fontfamily="#dinpro-blackitalic" this doesn't work (clearly not italic) , falls default font. i've tried lots of other variations work other fonts in font directory. for example, comic sans works: fontfamily="comic sans ms" (awesome...) now, why confused: if guess @ different way punctuate font name, renders correctly! this works: fontfamily="din pro black italic" in summary, here screen shot of different fontfamily settings in wpf: two questions: 1) how supp

mysql - Why isn't the index used? -

select `nen straatnaam` street, `nen woonplaats` city, gemeente, postcode, acn_distinct.zipcodes, acn_distinct.lat, acn_distinct.lng `acn_distinct` inner join crimes c on `nen woonplaats` = c.place , c.street_check = 0 order street asc explain gives me information: id select_type table type possible_keys key key_len ref rows 1 simple c ref idx_place,idx_street_check,fulltext_place idx_street_check 1 const 67556 using temporary; using filesort 1 simple acn_distinct ref id_nen_woonplaats id_nen_woonplaats 768 crimes.c.place 42 using index condition so why not using suggested indexes? it using index, idx_street_check , however, performance terrible, since it's creating temporary table , using filesort both notorious culprits. the question why it's not using index on crimes.plac

performance - Speed up deinterleave and concatenation for TIFF -

i work in neuro-lab records pictures of mouse brains. raw files cameras record record pictures alternating cameras (picture of brain, picture of mouse head, picture of brain, etc) we're converting these files tiff, deinterleaving them, , concatenating files. the concatenation far slow of use. i'm not yet learned enough in matlab able troubleshoot. how can improve speed of code? %convert micam raw tiff using image j javaaddpath 'c:\program files\matlab\r2013a\java\mij.jar'; javaaddpath 'c:\program files\matlab\r2013a\java\ij.jar'; mij.start('c:\users\lee\desktop\imagej'); mij.run('install...', 'install=[c:\\users\\lee\\desktop\\imagej\\macros\\matthias\\helmchen macros modified djm.ijm]'); mij.run('run...', 'path=[c:\\users\\lee\\desktop\\imagej\\macros\\matthias\\helmchen macros modified djm.ijm]'); mij.run('convert micam raw tiff'); pause (30); %to prevent race condition, needs fixed wait input mij.exit; %