Posts

Showing posts from July, 2015

mysql - SQL SUM top 5 values then JOIN results -

i want return top 5 voted items, sorted vote count. suppose best way sum each row's votes_up , votes_down , take top 5 of , join other table. here existing tables, items.id maps votes.item_id: items +----+--------+---------+ | id | name | site_id | +----+--------+---------+ | 10 | box | 111 | | 11 | hammer | 222 | | 12 | drill | 333 | | 13 | nail | 444 | +----+--------+---------+ votes +----+---------+----------+------------+ | id | item_id | votes_up | votes_down | +----+---------+----------+------------+ | 1 | 10 | 25 | 20 | | 2 | 11 | 200 | 100 | | 3 | 12 | 100 | 50 | | 4 | 13 | 50 | 20 | +----+---------+----------+------------+ these results back: +--------+-------+ | name | votes | +--------+-------+ | hammer | 100 | | drill | 50 | | nail | 30 | | box | 5 | +--------+-------+ select items.name, votes_up-votes_down votes_num items

javascript - HIghcharts tooltips only for start and end point. -

using line chart datetime information. seems work except reason tooltip come first point , last. not in between. i've tried fooling around xdateformat no avail. tooltip: { xdateformat: '%h:%m', shared: true }, any suggestions? fiddle: http://jsfiddle.net/jt7vp/ there issue data. in descending order, has been issue. i've updated fiddle here changes done in series:[{data:[]},{data:[]},{data:[]}] hope useful

How do I stop Xcode from showing me this assembly language when I'm debugging and step over? -

Image
i have "show disassembly" unchecked, after few step overs still shows up. this might code compiled release configuration rather debug. more difficult xcode relate machine instructions source code lines in case.

php - Modify string to seo url but keep Scandinavian letters -

i having trouble understanding how keep norwegian letters "æ ø Ã¥" in preg_replace function got modifying forum titles seo urls. website rendered in "iso-8859-1". how want it: someurl.com/read=kjøp_og_salg currently looks this: someurl.com/read=kj_p_og_salg //----- seo url function ------// public function make_seo_name($title){ $title = preg_replace('/[\'"]/', '', $title); $title = preg_replace('/[^a-za-z0-9]+/', '_', $title); $title = strtolower(trim($title, '_')); return $title; } i tried utf8_encode/decode $title before , after preg_replace done, didn't work. thank time! edit: solved, fixed "one trick pony". ended function. public function make_seo_name($title){ $title = utf8_encode($title); $title = preg_replace('/[\'"]/', '', $title); $title = preg_replace('/[^a-za-z0-9\ø\Ã¥\æ]+/', '_', $title); $title =

javascript - setTimeout with Bootstrap Modal not displaying after time out -

i'm trying delay showing bootstrap modal until 5 seconds have passed. here section of code. seems write have read on mdn. modal not appear after amount of time. appreciated. var timeout; function modalalert(message){ $("#mymodallabel").text("hey look!") $('.modal-body').html("<img src='"+message+"'>"); timeout = window.settimeout(showmodal,5000); } function showmodal(){ console.log("here") $("#mymodal").modal('show') } vijay ramamurthy helped me find solution: var timeout; function modalalert(message){ $("#mymodallabel").text("hey look!") $('.modal-body').html("<img src='"+message+"'>"); window.settimeout(function(){showmodal();},5000); } function showmodal(){ console.log("here") $("#mymodal").modal('show') }

php - Parsing JSON when multiple arrays returned in Objective C -

i trying parse json returned following link: https://icansolvecouk1.fatcow.com/prco303/loginjson.php?nickname=maggie&password=maggie which is: [{"sent":"2013-05-12 09:32:14","sender":"1","recipient":"1","message":"hey hey hey"},{"sent":"2013-05-12 16:39:02","sender":"2","recipient":"1","message":"another message"}] using following code in obj-c: nsdictionary *user = [result json]; nslog(@"nsdictionary returned: %@",user); nsarray* arrayofreturneditems = [user objectforkey:@"message"]; nslog(@"array returned: %@",[arrayofreturneditems objectatindex:0]); nsdictionary stores json value errors occur later on. new obj-c , json appreciated. checked on jsonlint.com says valid believe reason errors getting pulling 2 arrays (from url) not parsing correctly. have access server serving json

ios - How do I move FPPopover as low as I want? If I push it too low, it jumps back to the top -

i'm using fppopover present pop on view iphone app. i'm having issue, however, when present it, allow me present low or jump top. , before gets cut off anyway. for example: [self.speedoptionspopover presentpopoverfrompoint:cgpointmake(0, 235)]; works fine, if put 255 instead of 235 (as it's 40px bottom) jumps top. does have experience or how fix it? also, bonus points if can explain why content popover starts 50px top, when want start higher. how can change also? more code creation: - (void)speedoptionstapped:(uibarbuttonitem *)sender { // set delegate in controller acts popover's view self controls on popover can manipulate wpm , number of words shown self.speedoptionscontroller.delegate = self; self.speedoptionspopover.arrowdirection = fppopovernoarrow; self.speedoptionspopover.border = no; self.speedoptionspopover.contentsize = cgsizemake(320, 190); [self.speedoptionspopover presentpopoverfrompoint:cgpointmake(0, 235)]; }

php - Using cURL to findout where website redirects? -

i'm trying server redirect url. have tried function http_head_curl($url,$timeout=10) { $ch = curl_init(); curl_setopt($ch, curlopt_url, $url); curl_setopt($ch, curlopt_timeout, $timeout); // in seconds curl_setopt($ch, curlopt_header, 1); curl_setopt($ch, curlopt_nobody, 1); curl_setopt($ch, curlopt_followlocation, 1); curl_setopt($ch, curlopt_returntransfer, 1); $res = curl_exec($ch); if ($res === false) { throw new runtimeexception("curl exception: ".curl_errno($ch).": ".curl_error($ch)); } return trim($res); } echo http_head_curl("http://www.site.com",$timeout=10); result is; http/1.1 301 moved permanently date: sun, 12 may 2013 23:34:22 gmt server: litespeed connection: close x-powered-by: php/5.3.23 set-cookie: phpsessid=0d4b28dd02bd3d8413c92f71253e8b31; path=/; httponly x-pingback: http://site.com/xmlrpc.php content-type: text/html; charset=utf-8 location: http://sit

jquery - Selecting the child of a block in a plugin -

i'm working on plugin right , can't work. i want make container this one if click on block, cover should move specific direction. every time want child of .coverframe-container , gives me link of file + ' > .cover' here code: $.fn.coverblock = function () { // settings var settings = $.extend({ direction: 'up', speed: 400 }); $(this).click(function () { element = this; console.log(this + ' .cover'); }); } $(function () { $('.coverframe').coverblock(); }); this in debug now. the console-log in click-function gives me this: file:///g:/wamp/www/training/index.html# .cover without addition + ' .cover' gives me following: <a href="#" class="coverframe" style="display: block; height: 100px; width: 100px;">...</a> how can fix can select child , work it? try using $(this) within click function.

c++ - EX_BAD_ACCESS when calling vector.empty() -

i'm getting ex_bad_access when calling vector.empty on empty vector. bool empty = elements.empty(); its throwing exception here; /** * returns read-only (constant) iterator points 1 past * last element in %vector. iteration done in * ordinary element order. */ const_iterator end() const { return const_iterator(this->_m_impl._m_finish); } // exception when calling; /** * returns true if %vector empty. (thus begin() * equal end().) */ bool empty() const { return begin() == end(); } // exception the reason elements invalid object @ point. should never exception valid vector object.

Can I modify the type of an object in python -

specifically want change stringtype nonetype. know how use int() , str() convert between inttype , stringtype, can't find similar solution nonetype. there simpler solution besides using built in functions int , str? sorry ambiguous, have program enters string 'print("check")' python shell , need converted function. assumed because functions have type nonetype converting string nonetype make usable. ideas? eval() works purposes cairnarvon, thanks! you can trivially define own function this: def none(*args): """converts arguments none.""" return none but that's pretty pointless. use literal none whenever need one. as clarification, you're looking eval or ast module, though should consider you're hoping accomplish; eval , in particular, create more problems solve.

ios - Why can't I have property named 'retain' when using XCode? -

in xcode 4.6.2 arc, if have property in class named 'retain', either ide or compiling stack funny, making class can't used in usual pattern: [[myclass alloc] init] . for instance, if define class foo as // foo.h #import <foundation/foundation.h> @interface mosquittomessage : nsobject @property (nonatomic, assign) bool retain; -(id)init; @end // foo.m #import "foo.h" @implementation mosquittomessage -(id) init { self = [super init]; return self; } @end it compile , run, however, can't use foo *foo = [[foo alloc] init]; to create foo. above statement in run time set foo nil. traced problem using debugger , found alloc in fact returned valid foo, yet inside init, got deallocated reason , returned self nil. anyone has idea 'bug' in xcode or compiling system? added: sure 'retain' reserved in obj-c, question why didn't compiler complain if it's not allowed? instead, generated wrong code. retain

google app engine - AppEngine Error Code 202 - Task Queue -

i have task queue setup google app engine in java. works long time already, notice uri error in admin dashboard. a problem encountered process handled request, causing exit. cause new process used next request application. (error code 202) what caused error? i'm seeing well. little progress far, did find following, may help: forum thread: https://groups.google.com/forum/?fromgroups=#!topic/google-appengine/jufkxpik1js issues: https://code.google.com/p/googleappengine/issues/detail?id=8560

php - How to get custom URL structure after passing variable through GET method? -

i have problem in php form : isbn number variable . view.php opens in url : localhost/../view.php?isbn=0810982463. whereas want url structure localhost/..../0810982463. know can done using post method, can done using method ? <form action="view.php" method="get"> <p class="name"> <label for="isbn">isbn no. &nbsp;</label> <input type="text" name="isbn" id="isbn" value="0199555311"> </p> <p class="submit"> <input type="submit" value="search book" /> </p> </form> no matter what, form submission in query string format, @ google's form submission, or stack overflow's own searching. way things have been standardized across browsers. if want pretty, after submission, you'll need redirect user pretty url.

tomcat - Quartz schedular exception java.lang.OutOfMemoryError -

i using quartz schedular. after time of deployment showing folowing exception exception in thread "http-bio-8084-exec-3" java.lang.outofmemoryerror: permgen space exception in thread "http-bio-8084-exec-1" java.lang.outofmemoryerror: permgen space how resolve exception. try setting maximum size property of jvm while starting jvm -xx:maxpermsize=128m you can read more option here , here , here

python - How to normalize a list of positive and negative decimal number to a specific range -

i have list of decimal numbers follows: [-23.5, -12.7, -20.6, -11.3, -9.2, -4.5, 2, 8, 11, 15, 17, 21] i need normalize list fit range [-5,5] . how can in python? to range of input easy: old_min = min(input) old_range = max(input) - old_min here's tricky part. can multiply new range , divide old range, guarantees top bucket 1 value in it. need expand output range top bucket same size other buckets. new_min = -5 new_range = 5 + 0.9999999999 - new_min output = [int((n - old_min) / old_range * new_range + new_min) n in input]

Remove div without class when contains custom element with jquery -

i'm trying remove stray elements. have no class or id attributes whom have custom element without id or class attribute. there cases custom element have class name. the p should remain, have either text or video element. $("p:contains("$("getimage")")").remove(); is there better way work? edit "getimage" custom tag. <div class="ajaxposttext"> <p><getimage style="display:none;" height="360" width="640" src="http://localhost:8888/localtesting/wp-content/plugins/wp-o-matic/cache/687a91dca2_ku-xlarge.jpg" class="transform-ku-xlarge"></getimage></p> <p>movies long. film masterpieces can shave off few minutes here , there can off our butts, away laptops, out of theaters, eyeballs off tv little bit earlier. so. how short can movie gist of it? can done in 9 single frames?</p> </div> this remove p tags without id , c

Composite views in MvvmCross -

i have wpf mvvm application i'd refactor use mvvmcross support wpf , mono android implementations. our application's views consists of: a toolbar visible a navigation bar region a main view region a popup window region each of these regions usercontrol on main application window , uiservice swaps out views in each region. in case of pop-up window, usercontrol on main window that's visibility changes on show or hide calls uiservice. uiservice accepts context parameter allows state information passed view model shown. the main views typically composite of several child views. in these cases, main view model creates child view models exposed properties. main view sets these properties data context of child views. i think mvvmcross support style composite views, couldn't find example of such. there relevant mvvmcross examples? recommended approach implementing in mvvmcross? i think mvvmcross support style composite views, couldn'

Vim auto-source vimrc on save with symlink -

i have symlink points .vimrc 1 repo. vim loads fine, can't auto-source upon being changed. i have typical: if has("autocmd") autocmd! bufwritepost .vimrc source $myvimrc endif which works if vimrc not symlinked. i have similar setup ~/.vimrc symlink git repository. following autocommand works me: autocmd! bufwritepost .vimrc source %

Showing the no. of entries in the template in Django -

i created form form simple entries of question , wanted show total no. of questions entered in template. can show me how ? use syntax :- <p>{{ question_list|length}}</p>

java - AppWidget refresh 12 times -

i have code: int = 0; while(true){ i++; remoteviews.settextviewtext(r.id.textview1, "" + ); appwidgetmanager.updateappwidget(thiswidget, remoteviews); try { thread.sleep(1000); } catch (interruptedexception e) { // todo auto-generated catch block e.printstacktrace(); } this code refresh widget, 12 times. when "i" reaches 12 nothing happens. how fix it? appwidgetprovider class extends broadcastreciever , , not correct have while(true) loop in reciever class. if want refresh widget @ interval of every 1 second provide information in android:updateperiodmillis="1000" in app widget xml file placed @ res/xml/ folder in project. thanks! bhushan

java - Split a PdfTable in next page -

how split pdftable in next page in java? i generating pdf document using itext in java. pdf has header , table. when table continues next page, 2 rows of table overlaps header. how display remaining table rows below header in next page. here using header_footer java class , call object of header_footer in jsp page like- header_footer event = new header_footer(); writer.setpageevent(event); my header_footer class give below /* * change template, choose tools | templates * , open template in editor. */ package mis4acjml; import java.io.fileoutputstream; import java.io.ioexception; import com.itextpdf.text.document; import com.itextpdf.text.documentexception; import com.itextpdf.text.element; import com.itextpdf.text.exceptionconverter; import com.itextpdf.text.image; import com.itextpdf.text.pagesize; import com.itextpdf.text.paragraph; import com.itextpdf.text.phrase; import com.itextpdf.text.rectangle; import com.itextpdf.text.pdf.columntext; import com.itextpdf.tex

Disable a row based on condition from database in Liferay Search Container -

i have disable row retrieve database using liferay search container. have conditions stored in database. what wish achieve this: i displaying list of students attendance need marked. sometimes students may take leave in advance in case attendance pre-marked in database. so when form marking attendance displayed, want disable marking attendance disabling row containing data of student attendance marked. what want is, if attendance pre-marked, show row on form pre-marked attendance , not allow user mark attendance student i.e. disable row. how can achieve this? edited: code snippet mark attendance today: <%=new java.util.date()%> <portlet:actionurl name="updateatt" var="updateatturl" /> <aui:form name="updateatt" action="<%=updateatturl.tostring() %>" method="post" > choose date mark attendance: <liferay-ui:input-date formname="attendance

visual studio - Corrupt project VS2012 -

opening solution (2 projects) in vs2012, several errors: 1. unable load 1 or more breakpoints. 2. value not fall within expected range (opening web.config) looks corrupted. there easy way recover? breakpoints stored? value (suddenly) out of range? in advance help! there still (hidden) .suo file. removing file resolves both problems!

java - Arquillian Garphene, page loaded but unable to launch javascript -

i'm using arquillian graphene selenium 2. the trouble coming graphene.guardnorequest(); method. error thrown : java.lang.runtimeexception: org.openqa.selenium.webdriverexception: can't execute javascript before page has been loaded! build info: version: '2.25.0', revision: '17482', time: '2012-07-18 22:18:01' system info: os.name: 'windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.6.0_43' i've tried elements assert exist, i've catched page source , seems ok. i've tried put wait like wait.until(expectedconditions.visibilityofelementlocated(by.cssselector("selector here"))); someone has/had same struggle? update : problem solved i've solved problem, need time make clear explain happens , what's solution

combined cache provider for azure in c# -

for website have in azure cloud , work on, need implement "hybrid" cache. meaning, website displays table of records db, , provides option either add new records or update existing ones. reads, need implement in-process cache, , writes (adding, updates) need have out-of-process cache. i'm pretty new @ c# , azure. i'll glad begin with... currently, use simple sql commands display, add or update: protected void page_load(object sender, eventargs e) { if (page.ispostback) gridview1.databind(); } protected void button1_click(object sender, eventargs e) { string insertcommand = "insert [students] ([student_name], [gpa]) values (@student_name, @gpa)"; string connstring = sqlazuredatasource.connectionstring; using (sqlconnection conn = new sqlconnection(connstring)) { using (sqlcommand comm = new sqlcommand()) {

android - How can I use AlphaAnimation on a bitmap pre API 11 -

this link shows how use alphaanimation on view pre api 11. what have animate works api 11 , above. objectanimator fader = objectanimator.ofint(paint1,"alpha", 250, 00); fader.setduration(1000); fader.setrepeatcount(0); fader.setrepeatmode(valueanimator.restart); fader.addupdatelistener(new valueanimator.animatorupdatelistener() { @override public void onanimationupdate(valueanimator animation) { // todo auto-generated method stub invalidate(); } }); and in ondraw() method, animate bitmap as @override protected void ondraw(canvas canvas) { // todo auto-generated method stub super.ondraw(canvas); canvas.save(); canvas.drawbitmap(bitmap1, x, y , paint1); canvas.restore(); } what api can use make work api 8 ?

android - Adding multiple fonts for a ViewPager -

this question exact duplicate of: custom font in view pager in android 1 answer how add custom font viewpager. i creating book reader app has display sanskrit , english script. how can achieve pointers helpful. try use in web view , load html loads. can use additional fonts adding font file in assets , want add in css html file.

java - Changing user's display name on facebook -

i want edit user's display name on facebook through facebook api call in playframework.can me? looking @ graphapi users http://developers.facebook.com/docs/reference/api/user/ this not possible.

Xcode freezes on launch -

Image
i have checked out project our svn repository , every time try open it, freezes. have tried cleaning out autosave information , locked saved application state folders. cleaned , re-cleaned deriveddata , on. things didn't try reinstalling xcode or creating new user ... since don't have time setup right now. if else fails have it. below screenshot ... click anywhere in xcode, freezez spinner going on madman. xcode version: 4.6.1 solved ... thanks brian chan defaults write com.apple.dt.xcode ideindexdisable 1 put in terminal. disable autocomplete , jump definition though

jquery mobile - Jquerymobile. define a transition between pages -

since of pages in same tag "body", after leaving page audio, player continues play. how can catch user has left page , stop audio? check if current page not page playing audio , handle accordingly.you can use below code know current page. var activepage = $('.ui-page-active').attr('id'); if (activepage != "your-audio-page-id") { }

android - When using scrollTo ListView does not refresh, but when manually scrolling it refreshes -

i have different colors different lines in listview, setting color of textbox depending on line number (in getview() of adapter). when manually scroll listview upwards correct color displayed in bottom lines revealed. when use scrollto, doesnot happen, lines revealed have same color (they not updated). has faced issue? seems baffling! listview#scrollto doesn't scroll list contents. (it's standard view method, , not specific lists @ all: scrolls listview view itself.) instead, try using listview#setselectionfromtop(0, int y) scroll. api 19+ has listview#scrolllistby(int y) method if you're programming kitkat , up.

BlackBerry stop receiving push notifications -

i have signed rim blackberry push service evaluation credentials can test push notifications implementation. i used low level sample server send push , build client side. worked till now. application stopped showing received push messages. instead every time send push can see in right corner arrow loading (like being processed) no push notification shown. is strange , cause didnt change on code.. ideas? edit actually found out when deploy app in device , push doesnt work described. when restart phone though , push works fine. think maybe because , call background process listening push , when phone gets restarted. have on code: http://codepad.org/ddjvyoox when launch app , register bis push think dont listen them. every time phone restarts.. think might problem? curious behind firewall chance? to consider adding firewall exceptions have access eval/prod ppg need add ip addresses below: eval: 68.171.224.57 68.171.224.59 production: 74.82.67.65 74.8

excel - How to count same values in a column for certain users -

Image
i have column appear different users , other 1 appear value. each user can have several of these values , can repeated. know how count same values in same column need know quantity of identical values each user. example: user value user1 100 user1 300 user1 100 user1 200 user1 300 user1 100 user1 100 user1 400 user2 100 user2 100 user2 100 user2 400 user2 100 user2 200 user2 200 then should appear like: user value count user1 100 4 user1 200 1 user1 300 2 user1 400 1 and same second user , on. edit - sorry misunderstood had do... had more values , though had focus in 1 value apparently had take in count of them: need following: user v1 v2 v3 v4 user1 c b

slider - Is there a SliderBar/TrackBar with three thumbs which can be used in ASP.NET? -

i relatively new asp.net have winforms experience. basically want use 2 types of slider bar controls: basic sliderbar user drags 1 thumb , can pull value control. a sliderbar 3 thumbs minimum, predicted , maximum. predicted value must stay within min , max values. need able pull 3 values control. (something http://jqueryui.com/slider/#range third thumb in middle) other points mention, these controls need created dynamically number of them depend on values saved in sql database. also, have created controls work in winforms doubt can port these on used in asp.net? has had experience using sliderbars in asp.net? there free packages can used described? many many help, support or advice can provide!! im thinking can use jquery control, concern when a sliderbar 3 thumbs minimum does mean might have 4,5 or more thumbs in control? in opinion can use jquery control having min , max values declared database , predicted value thumb, use jquery 3 values, take @

ember.js: my bindings are working in a context but not in another -

i have chunk of code working in simple environment: here index.hbl {{view app.searchinvoicableproductformview}} here view app.searchinvoicableproductformview = em.view.extend templatename: 'search_invoicable_product_form' invoicablesearch: "search..." here template search_invoicable_product.hbl : {{view ember.textfield valuebinding="invoicablesearch" size="8"}}<br /> {{#each invoicable in results}} {{invoicable.name}}<br /> {{/each}} and here controller: app.indexcontroller = ember.controller.extend invoicablesearch: "cerca..." results: (-> if @get("invoicablesearch").length > 3 app.invoicable.find(q: @get("invoicablesearch")) ).property("invoicablesearch") in context working fine. when type text field search performed while in context bindings not work: i'm @ path: invoices/new here router: app.router.map -> @resource "invoi

asp.net - How to Use ScriptManager.RegisterClientScriptBlock from Javascript -

i want use scriptmanager.registerclientscriptblock(ctrlname, page.gettype(), "msg", _script, false) from javascript function in onclientclick="checkmaxlength(this);" of textbox. want show custome popup.i able use in .cs want use inside javascript. the whole point of function make client run line of javascript, from server . from javascript code, can run more code directly.

oauth - How to handle authorizing the same third-party application multiple times for a single user account? -

i'm working on cloud-storage api, authorized via oauth. users of third-party applications can permit said application access files/data via our restful api. currently, limiting third-party app access users account once. e.g., access token table has unique on consumer column , user column. makes sense @ first glance, user should never sent our service authorize third-party application twice, since third-party know user tied our service , wouldn't need re-authorized. however, if user has 2 accounts on third-party app, , want said app connect single account on our service twice? seems likely, given prevalence of multiple accounts on services such reddit. here possible solutions i've come far, none of them being perfect: display error during second auth request: seems frustrating experience user, "cop out" of sorts. delete previous token: annoy user, previous accounts stop working. if display warning, hard explain happening. return same access token f

f# - if requires an else clause -

i have following code in function, , eliminate duplication of dosomethingelse() : fun -> if = b let c = expensiveoperation() if c = d result else dosomethingelse() else dosomethingelse() i think should able eliminate both else clauses. , let return either result or dosomethingelse() . when that, error message compiler is: "this expression expected have type unit here has type int " why if expression require else clause? this equivalent wrote, wonder if mean else. if = b && expensiveoperation() = d result else dosomethingelse()

blackberry 10 - How to execute some code on UI thread -

i have worker thread (pthread) process things on background, want display result on screen. must execute code on ui thread or main thread. in ios can use dispatch_async(dispatch_get_main_queue(), ^{ /* code */ }); , in android can use view.queueevent() . can show me how same thing bb 10 native sdk? thanks, solution updated. i figured out 2 methods, first simple, didn't work, don't know why. put here if wants at. method 1. use bps_channel_exec execute code on thread owns channel. on ui thread, create channel, set active. , on worker thread, active channel calling bps_channel_get_active , use bps_channel_exec . didn't work me, continue find reason. method 2. this method more complicated, simple in idea. on worker thread, push event ui thread. on ui thread main loop, add event handler process kind of event. on worker thread: register domain calling bps_register_domain , use domain create event calling bps_event_create . next, push event active channel on

c# - Insert 150 columns in a single table using stored procedures -

we have requirement use stored procedure update/insert data in sql table. i can create stored procedure update 150 columns, require need take 150 columns values object have , explicitly pass 150 columns stored procedure. can please suggest way in don't have pass 150 values explicitly ? the other answers here have shown alternative ways accomplish goal. however, caution against use several reasons. most brittle. meaning have potential problems not show compile time and, in many cases, won't show unless every single edge case tested. most result in same or more code. aren't saving code having parse string or turning xml file temp table prior updating/inserting main table. the non-standard ways means next programmer on project going need pay attention fact procedure operates differently others no other reason save few lines of c# code. point is, go ahead , create stored procedure usual way , call usual way. issues show in compile time or limited

java - App code design Problems -

so, i'm having 2 main code design problems in app... my app consists in sending ssh commands remote host. right have separated thread (singleton) wich gets messages through handler wich specifies wich next command sent, or username/password/ip (kind of messy works...). this approach works unidirectional commands, i'm planning make bidirectional wich don't know how implement. far know android doesn't allow change ui elements thread listener pattern wouldn't it. also, read shouldn't save things in application object, wich i'm doing saving whether app running full or lite mode... don't know should save in order not make hackable (sqlite-sharedprefs editable...) only general hint: there activity.runonuithread() execute code (later) on main thread.

java - Regex for password matching -

i have searched site , not finding looking for. password criteria: must 6 characters, 50 max must include 1 alpha character must include 1 numeric or special character here have in java: public static pattern p = pattern.compile( "((?=.*\\d)(?=.*[a-z])(?=.*[a-z])|(?=.*[\\d~!@#$%^&*\\(\\)_+\\{\\}\\[\\]\\?<>|_]).{6,50})" ); the problem password of 1234567 matching(it valid) should not be. any great. make sure use matcher.matches() method, assert whole string matches pattern. your current regex: "((?=.*\\d)(?=.*[a-z])(?=.*[a-z])|(?=.*[\\d~!@#$%^&*\\(\\)_+\\{\\}\\[\\]\\?<>|_]).{6,50})" means: the string must contain @ least digit (?=.*\\d) , lower case english alphabet (?=.*[a-z]) , , upper case character (?=.*[a-z]) or | string must contain @ least 1 character may digit or special character (?=.*[\\d~!@#$%^&*\\(\\)_+\\{\\}\\[\\]\\?<>|_]) either conditions above holds true, , string must between 6 50

Size of Qt containers: is QMap much larger than Qlist? -

i developing software maps information in 3d space. use container hold information. container use is qlist< qlist< qmap<float, qlist<quint16> > > > lidardata; which 2d grid representing rectangular area each cell 1 meter x 1 meter, , in each cell qmap contains key value representing height , list of 4 related values @ height. way can store 5 values (height + other values). insert values in loop ( rown , coln row , column indexes respectively) qlist<quint16> newlist; newlist << (width*100.0) << (1000.0+sens*100.0) << (quint16)(intensity*1000.0) ; lidardata[ rown ][ coln ].insert( heightvalue, newlist); before approach instead of using qmap<float, qlist<quint16> used qlist<quint16> , appending 5 values. question is: running program runs out of memory quite fast. took 800mb of memory complete first solution (qlist instead of qmap), runs out (at 1.4 gb) @ 75% of total data-storing process. can confirm stor

windbg: set data breakpoint at dll + offset -

i want set data-write breakpoint on value of xul.dll+0x7d760, using command script. i can print base address of xul.dll using lm , , manually set breakpoint with ba w (baseaddress + 0x7d760) but can't figure out way store base address of xul.dll pseudo-register automatically. there way somehow store or parse results of lm xul pseudo-register? .foreach /ps 4 /ps 3 (modbase {lm p m xul}) {ba w 4 (${modbase} + 0x7d760)} in command, module's base address stored in ${modbase} . substitute xul module, or edit {ba w 4 (${modbase} + 0x7d760)} block substitute different command or offset necessary.

When is memoization automatic in GHC Haskell? -

i can't figure out why m1 apparently memoized while m2 not in following: m1 = ((filter odd [1..]) !!) m2 n = ((filter odd [1..]) !! n) m1 10000000 takes 1.5 seconds on first call, , fraction of on subsequent calls (presumably caches list), whereas m2 10000000 takes same amount of time (rebuilding list each call). idea what's going on? there rules of thumb if , when ghc memoize function? thanks. ghc not memoize functions. it does, however, compute given expression in code @ once per time surrounding lambda-expression entered, or @ once ever if @ top level. determining lambda-expressions can little tricky when use syntactic sugar in example, let's convert these equivalent desugared syntax: m1' = (!!) (filter odd [1..]) -- nb: see below! m2' = \n -> (!!) (filter odd [1..]) n (note: haskell 98 report describes left operator section (a %) equivalent \b -> (%) b , ghc desugars (%) a . these technically different becaus

c# - How to delete the data for a student in the array and list box, and keep the array and listbox synchronized -

i have 2 dimensional array, , add button add values text box list box , have delete button delete selected value list box , array. this line of code won't work because 2 dimensional array. names[lstindex] = null; string[,] names = new string[10,3]; const int student_name = 0; const int student_id = 1; const int major = 2; private void btnexit_click(object sender, eventargs e) { close(); } private void assignarray(int row) { names[row,student_name] = txtstudentname.text; names[row, student_id] = txtstdbox.text; names[row, major] = txtmjbox.text; } private string buildstudent(int row) { string answser = ""; int upperlimit = names.getupperbound(1); (int column = 0; column <= upperlimit; column++) { answser += names[row, column] + ""; } return answser; } private void btnadd_click(object sender, eventar

WebSphere 7.0 won't run filter for root URL -

i have war file defines filter run on urls: <!doctype web-app public "-//sun microsystems, inc.//dtd web application 2.3//en" "http://java.sun.com/dtd/web-app_2_3.dtd"> ... <filter> <filter-name>ourredirectservletfilter</filter-name> <filter-class>com.mycompany.redirectservletfilter</filter-class> </filter> ... <filter-mapping> <filter-name>ourredirectservletfilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> the filter designed perform redirects 'convenience' urls corresponding 'actual' url, don't think that's relevant problem. on websphere 7.0, filter doesn't run requests root url, e.g. /ctxroot or /ctxroot/ ; instead 404 response. does run /ctxroot/blah , whether blah valid or invalid path. i've tried adding additional filter mappings url patterns <url-pattern>/</url-pattern> , <url-p

dom - How to get an element's index by using xPath and text value -

i have following structure <div class='list'> <div class='column'>aaa</div> <div class='column'>bbb</div> ... <div class='column'>jjj</div> </div> i'm new xpath, it'll helpful assistance. index of element text value "aaa" examp, expect int = 1 / 0... thanks

sql - Last non-empty child over period using MDX -

[edit: example not entirely correct] i've been pulling hair out on mdx issue... making cube concerning billing. i have 2 (relevant) dimensions: budgetbill , month , 1 measure: amount budgetbill date amount 1548632 2012-11-04 50 1548632 2012-11-23 40 <-- 1548632 2012-12-16 70 <-- 1724687 2012-10-02 120 1724687 2012-10-23 170 1724687 2012-10-89 200 <-- total 310 i have date hierarchy [bb updatedate] year - quarter - month - week - date so need have last amount per month, on budgetbill. in above example 40 + 70 + 200 = 310 one of mdx code snippets i've tried with member [measures].[test] sum(tail(nonempty(descendants([bb updatedate].[bb updatedate hierarchy].currentmember, [bb updatedate].[month]) ,[measures].[amount]), 1),[measures].[amount]) select [measures].[test] on columns ,nonempty([bb updatedate].[month]) on rows [budgetbill] {[budgetbill].[budgetbillnr].&[1548632],[budgetbil

Dispatch messages from a safari extension popover to the global page -

i have safari extension popover needs communicate global page. content-script using safari.self.tab.dispatchmessage(name,data); to accomplish that. popover didn't find way that. know can access methods in global page directly safari.extension.globalpage.contentwindow but goal reuse code fragments used in content-scripts. same chrome version of plugin. is there code little clever proxy emulates safari.self.tab.dispatchmessage(name,data); from popover? to honest it's easier have different code in popover , injected scripts. if want, this: function dispatchmessage(name, message) { if (safari.self.tab) { safari.self.tab.dispatchmessage(name, message); } else if (safari.extension.globalpage.contentwindow) { safari.extension.globalpage.contentwindow.handlemessage({name: name, message: message}); } } then use dispatchmessage('foo', 'bar') in both popover , injected scripts. it's bit hacky though, because

c# - How to parse delimited files to be compared -

there text file formatted example below need search students class name: michael | straham | eng101(4.0) | mth303 jacob | black | sci 210 (2.3) | eng101 ian | summers | mth303(3.30) | sci 210 the delimited symbols ( | ) the class names "eng101, sci210, mth303." search each line text class name , somehow index them can compared. end result this: eng101: michael straham, jacob black please assist. in advance! i'm assuming you're reading in input line line. you can use string.split() accomplish (the first part of) trying do. for example, following code string s1 = "michael | straham | eng101(4.0) | mth303"; char[] separators = { '|' }; string[] values = s1.split(separators); would give array of 4 strings ( "michael", "straham", "eng101(4.0)", "mth303"). can analyze values array see in class. i'd have code looks (in pseudocode): foreach (line in input) { string s1 = line;

javascript - flowplayer: coverImage as data attribute -

i'm calling flowplayer this: flowplayer("a.rmplayer", "libs/flowplayer/flowplayer.swf", { plugins: { audio: { url: 'libs/flowplayer/flowplayer.audio.swf' }, controls: { volume: true } } }); i'd have different covers each mp3 file being called. flowplayer provides coverimage variable (see http://flash.flowplayer.org/plugins/streaming/audio.html ), can somehow have images in data attribute? i've ended using following code, seems work flawlessly. link: <a data-toggle="modal" class="rmplayer" data-fpurl="http://releases.flowplayer.org/data/fake_empire.mp3" data-fpimg="http://releases.flowplayer.org/data/national.jpg">click me</a> and corresponding javascript (with '#rmplayerinterface' being modal window) <script type="text/javascript"> $(document).read

reporting services - SSRS 2008 r2 report with multiple tablixes is cutting the size of the tablix to one third of the page? -

i have report have inherited. end user stating when ssrs report exported either pdf or excel chopping 4 5 page report 15 16 page report in pdf or excel format. (there 5 tablixes on page) i thoroughly confused, have never seen before. have been reviewing properties of report , of tablixes not see out of place. it looks if tablixes being allowed 1/3 1/4 of page, guessing due setting. i have tried report page properties size of page , also, consume white space setting , neither have helped. ok, after trying every setting in book. found had footer property being astronomically large, don't see in rendered preview.

Running CMD as administrator with an argument from C# -

i want run cmd.exe administrator arguments c# in order prevent uac popup. necessary in order use automated installation process. command passing in path installation file (.exe) /q quiet installation. when run code, there cmd popup, runs if didn't execute anything. public static string executecommandasadmin(string command) { processstartinfo procstartinfo = new processstartinfo() { redirectstandarderror = true, redirectstandardoutput = true, useshellexecute = false, createnowindow = true, filename = "runas.exe", arguments = "/user:administrator cmd /k " + command }; using (process proc = new process()) { proc.startinfo = procstartinfo; proc.start(); string output = proc.standardoutput.readtoend(); if (string.isnullorempty(output)) output = proc.standarderror.readtoend(); return output; } } there @ least 1 problem c

ios - Converting 16-bit short to 32 bit float -

in tone generator example ios: http://www.cocoawithlove.com/2010/10/ios-tone-generator-introduction-to.html i trying convert short array float32 in ios. float32 *buffer = (float32 *)iodata->mbuffers[channel].mdata; short* outputshortbuffer = static_cast<short*>(outputbuffer); (uint32 frame = 0, j=0; frame < innumberframes; frame++, j=j+2) { buffer[frame] = outputshortbuffer[frame]; } for reasons, hearing added noise when played speaker. think there problem conversion short float32? yes, there is. consider value-range floating point samples -1.0 <= xn <= 1.0 , signed short -32767 <= xn <= +32767 . merely casting result in clipping on virtually samples. so taking account: float32 *buffer = (float32 *)iodata->mbuffers[channel].mdata; short* outputshortbuffer = static_cast<short*>(outputbuffer); (uint32 frame = 0, j=0; frame < innumberframes; frame++, j=j+2)

conditional - Output for sample code for an upcoming exam concerning pthread -

pthread_mutex_t mutex = pthread_mutex_initializer; pthread_cond_t cond = pthread_cond_initializer; int token = 2; int value = 3; void * red ( void *arg ) { int myid = * ((int *) arg); pthread_mutex_lock( &mutex ); while ( myid != token) { pthread_cond_wait( &cond, &mutex ); } value = value + (myid + 3); printf( "red: id %d \n", value); token = (token + 1) % 3; pthread_cond_broadcast( &cond ); pthread_mutex_unlock( &mutex ); } void * blue ( void *arg ) { int myid = * ((int *) arg); pthread_mutex_lock( &mutex ); while ( myid != token) { pthread_cond_wait( &cond, &mutex ); } value = value * (myid + 2); printf( "blue: id %d \n", value); token = (token + 1) % 3; pthread_cond_broadcast( &cond ); pthread_mutex_unlock( &mutex ); } void * white ( void *arg ) { int myid = * ((int *) arg); pthread_mutex_lock( &mutex ); while ( myid != token) { pthread_cond_wait( &cond, &

html - Normalize CSS w/local Stylesheet does not appear correct -

i have been doing web design little on year now, still have strange things happen on front end sometimes. creating simple template personal use using following code: <!doctype html> <html> <head> <title>matt's template</title> <!-- stylesheets --> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/2.1.0/normalize.css" type="text/css" /> <link rel="stylesheet" href="css/general.css" type="text/css" /> </head> <body> <section class="container"> <h1>matt's template</h1> </section> <!-- javascript libraries --> <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.0.0/jquery.min.js" ></script> <!-- javscript --> <

c - Using Pthreads in a Mulithreaded Server -

i programming mulithreaded client/server between processes program uses message queue's. server handle message's send clients, , later should give work threads continue handling it's processes. every client have different message queue. after making connection of 1st client , sending thread handle using pthread_join doesnt allow me to receive new connections on main thread,cause it's blocked how can fix it. receiving new messages in main thread ( or other solution if possible) sending threads handle client message's , after. getting receive new message very simple, make threads create detached main thread - means don't need "pthread_join" them anymore. main thread getting new connections , new request existing connections in loop, if it's new connection start new thread , if it's request existing connection it's add request thread's queue (using lock on it's mutex ofcourse).

C# SQL Server query -

this code segment have written in c#. mobile , name columns in table. problem there wrong format of query. syntax correct if want connect 2 queries in c # using or? sqldataadapter da = new sqldataadapter("select * [contact management] mobile='"+convert.toint32(txtsearch.text)+"' or name='"+txtsearch.text+"'",con); no, syntax not correct. it's vulnerable sql injection attacks. need build this: sqlcommand cmd = new sqlcommand("select * [contact management] mobile= @search or name= @search") sqldataadapter = new sqldataadapter(cmd); cmd.parameters.add("@search", sqldbtype.nvarchar, 50).value = txtsearch.text; you write query way: select * [contact management] @search in (mobile, name)

r - concatenating strings to make variable name -

i want change name of output of r function reflect different strings inputted. here have tried: kd = c("a","b","d","e","b") test = function(kd){ return(list(assign(paste(kd,"burst",sep="_"),1:6))) } this simple test function. warning (which bad error me): warning message: in assign(paste(kd, "burst", sep = "_"), 1:6) : first element used variable name ideally ouput a_burst = 1, b_burst = 2 , on not getting close. i split dataframe contents of vector , able name according name vector, similar how split data frame rows, , process blocks? but not quite. naming imperative. something this, maybe? kd = c("a","b","d","e","b") test <- function(x){ l <- as.list(1:5) names(l) <- paste(x,"burst",sep = "_") l } test(kd)