Posts

Showing posts from January, 2014

How can place an element at the bottom of another element using CSS? -

this question has answer here: how align content of div bottom? 20 answers look @ this: http://jsfiddle.net/unimous/88uqj/ <div id="d1"> <div id="d2"> </div> </div> #d1 { height: 3000px; background-color: red; } #d2 { background-color: green; height: 40px; width: 40px; position: absolute; bottom: 0px; } i want make div d2 appear @ bottom of d1, not bottom of screen. why position: absolute doesn't work here? add position:relative d1 div jsfiddle example absolutely positioned elements positioned respect closest positioned ancestor.

javascript - Spotify: getting recent tracks (HTML) -

i've been searching way display list of recent songs have been played on spotify account, without luck. account not linked facebook, can't history facebook music. there simple way this? like @vigrant above mentioned, there no way without third party service. can setup last.fm "scrobbling" can view track listening history.

c++ - taking input of a string word by word -

i started learning c++. playing around , came across problem involved taking input of string word word, each word separated whitespace. mean is, suppose have name place animal as input. want read first word, operations on it. read second word, operations on that, , read next word, on. i tried storing entire string @ first getline #include<iostream> using namespace std; int main() { string t; getline(cin,t); cout << t; //just confirm input read correctly } but how perform operation on each word , move on next word? also, while googling around c++ saw @ many places, instead of using "using namespace std" people prefer write "std::" everything. why's that? think same thing. why take trouble of writing again , again? put line in stringstream , extract word word back: #include <iostream> #include <sstream> using namespace std; int main() { string t; getline(cin,t);

c++ - Display hex per character in the message? -

would display hex per char in message(simple way if possibe, know can loop through chars , it): typedef struct{ double dtime; char cmessage[11]; } typecanmessage; typecanmessage cmmessage1 = {4.5, {0xd2, 0xf1, 0xe0, 0xf1, 0xf1, 0xf1, 0xf1, 0x23, 0x23, 0x23, 0x23}}; qmessagebox *msgbox = new qmessagebox(0); msgbox->setgeometry(qrect(qpoint(200,200),qsize(400,400))); msgbox->setinformativetext(qstring::number(cmmessage1.dtime, 'f', 8) + " " + qstring::number(cmmessage1.cmessage, 'x')); // <-- perhaps msgbox->exec(); error: "call of overloaded 'number(char[11], char)' ambiguous" modification: sprintf(cm, "%x", &cmmessage1.cmessage); qmessagebox *msgbox = new qmessagebox(0); msgbox->setgeometry(qrect(qpoint(200,200),qsize(400,400))); msgbox->setinformativetext(qstring::number(cmmessage1.dtime, 'f', 8) + " " + (qstring)cm); // <-- perhaps msgbox->exec();

mysql - SQL count function without limiting list due to WHERE -

i pretty new sql , trying generate report pulls kinds of different tables. simple select lines match parts keys no problem. although running issues when trying count how many times itemid shows in other tables. one of tables has partid , kinds of information part. table has partid , itemid (there more 1 item each part). third tables has row of itemid shows each new repaired item in list. i want able partid how many times associated itemids show in third table. have code follows: select tblensembleunepiece.enspieceid, count(tblquarantaine.itemid) 'quarantine' tblensembleunepiece, tblitem, tblquarantaine tblensembleunepiece.nopiece<>'' , tblensembleunepiece.enspieceid = tblitem.enspieceid , tblquarantaine.itemid = tblitem.itemid group tblensembleunepiece.enspieceid; this alone gives me list of partids , how many times associated itemids show third table. if again column code same principle: select tblensembleunepiec

Carrierwave only upload image when update action when using Rails 4 and nested form -

my model: class product < activerecord::base has_many :product_images, dependent: :destroy accepts_nested_attributes_for :product_images, :reject_if => lambda { |p| p['image'].blank? }, :allow_destroy => true end class productimage < activerecord::base belongs_to :product mount_uploader :image, productimageuploader validates_presence_of :image end my controller: def create @product = product.new(permitted_params.product) if @product.save redirect_to edit_admin_product_path(@product), notice: "success" else render :new end end def update @product = product.find(params[:id]) if @product.update_attributes(permitted_params.product) redirect_to edit_admin_product_path(@product), notice: "success" else render :edit end end permitted_params: class permittedparams < struct.new(:params) def product params.require(:product).permit(*product_attrs) end

Printing form with jquery printThis -

i pulling hair out trying inputs of form print. have tried printthis, printelement, window.print , every other iteration of print solution , cannot work. as background- multi-page form using jquery, jqmobile, html5, css3. has multiple types of inputs including multi-selects, radios, text, etc. print of input not need have form layout. here sample of code, long , intensive put sample: the head section <head> <meta charset="utf-8"> <link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.1/jquery.mobile-1.3.1.min.css" /> <link rel="stylesheet" type="text/css" href="form.css" /> <script type="text/javascript" src="http://code.jquery.com/jquery-1.9.1.min.js"> </script> <script src="jquery.maskedinput.min.js" type="text/javascript"></script> <script type="text/javascript" src="json2.min.js&quo

How do I customize the display of column headers in my WPF Datagrid? -

i trying customize datagrid. want insert content above column headers. trying use controltemplate this. have xaml code below. problem <contentpresenter /> not outputting anything. when load page, after textblock appears directly below before textblock nothing in between. want display column headers in space. <datagrid itemssource="{binding list}" autogeneratecolumns="true"> <datagrid.template> <controltemplate> <stackpanel orientation="vertical"> <textblock>before</textblock> <contentpresenter /> <!-- outputs nothing --> <textblock>after</textblock> <itemspresenter /> </stackpanel> </controltemplate> </datagrid.template> </datagrid> how display column headers between before textblock , after textblock? list

Generate dictionary file from Stata data -

i know can create dta file if have dat file , dictionary dct file. however, want know whether reverse possible. in particular, if have dta file, possible generate dct file along dat file (stata has export command allows export ascii file haven't found way generate dct file). stattransfer generate dct , dat file, wondering if possible without using stattransfer. yes. outfile create dictionaries export data in ascii (text) form. if want dictionaries , dictionaries alone, need delete data part. if want 2 separate files, need split each file produced outfile . either programmable in stata, or use favourite text editor or scripting language. dictionaries in ways idea, not important stata in versions.

tsql - Table should be created using year month and date in SSIS? -

i have folder .xlsx file every day. have ssis copy data .xlsx file table stackdata . need create ssis package such way when run package table should created year month , date stachdata_20130819 . declare @d char(10) = convert(char(8), getdate(), 112); if object_id('report_temp.msk_traffic_backup_' + @d) null begin declare @sql nvarchar(max) = n'select * report_temp.msk_traffic_backup_' + @d + ' property.door_traffic;'; print @sql; --exec sp_executesql @sql; end

Accessing the active directory info using iOS app through citrix -

the ios app developed our organisation hosted in citrix environment using xenmobile. users can download app ipad devices using citrix receiver. want know if can access active directory information (ntid , password of user etc.,) when launch ios application using citrix environment. is there api in ios access active directory information through citrix ? no, you'd have users enter ad credentials ios app have email on ios when configure exchange account.

c# - Denoising a chart (array of points) -

Image
i wanted ask think best way denoise array of coordinate points. i've got on bottom drawing , need convert what's on top drawing. thanks :) median filter a typical way of doing signal noise removal median filter . if have noisy signal f(x), can denoised signal g(x) following: g(x) = median z in r(x) (f(z)) where r(x) = [x-w/2, x+w/2] , w window width. example wikipedia has a concrete example . here's example of denoising using median filter. first image source, second image noisy version, third image denoised version, , fourth image difference between source , denoised versions. notice of error near boundaries, whereas error in regions without sudden jumps low. for broader @ topic, @ noise reduction .

css - Preventing buttons from moving on browser re size -

i quite new css apologies in advance. i have simple problem: navigation buttons move whenever re size window. have googled @ least week , can't seem find solution. have managed make not move horizontally on re size, reason continue move vertically on window re size. not understand why happening! can help?! in advance. here html `<!doctype html> <html> <head> <meta charset="utf-8"> <title>untitled document</title> <link rel="stylesheet" href="css/experiment.css" type="text/css"> </head> <body> <div id= "wrapper"> <a href:"#" class= "button1"> home </a> <a href:"#" class= "button2"> </a> <a href:"#" class= "button3"> how works </a> <a href:"#" class= "button4"> pricing </a> <a href

c# - Is it possible to make a list of generics that return a specific data type? -

class { } class b<t>:a { public t foo; } list<a> foo2 = new list<a>(); b<int> foo3 = new b<int>(); foo3.foo = 4; foo2.add(foo3); now foo2[0].foo won't work since class not have property. want make list can have bunch of generic items. currently converting type strings or byte array. there way create list of generic items return specific type back? for solution without type casts, should take @ accepted answer question: discriminated union in c# the union3 (or 4 or 5 or how many different types need) type proposed juliet allow have list accepts types want: var l = new list<union3<string, datetime, int>> { new union3<string, datetime, int>(datetime.now), new union3<string, datetime, int>(42), new union3<string, datetime, int>("test"), new union3<string, datetime, int>("one more test") }; foreach (union3<

JSON Processing Using Python -

i'm trying download json file, save file, , iterate through json file in order extract information , save variables. i'm going format message in csv format send data system. problem json data. appears dictionary within list , i'm not sure how process it. here's json: [ { "ipaddress" : "", "feeddescription" : "botted node feed", "bnfeedversion" : "1.1.4", "generatedts" : "2013-08-01 12:00:10.360+0000", "count" : 642903, "firstdiscoveredts" : "2013-07-21 19:07:20.627+0000", "lastdiscoveredts" : "2013-08-01 00:34:41.052+0000", "threattype" : "bn", "confidence" : 82, "discoverymethod" : "spamtrap", "indicator" : true, "supportingdata" : { "behavior" : "spamming", "botnetname" : null, "spamtrapdata&qu

Access jQuery node's children and its values using PHP to enter into db -

can please me out in problem. in real trouble , don't know how go ahead this. i have tr tag contains multiple div tags in it. whenever user clicks on 'add' link, same tr gets cloned incremented id , appended table. now, want enter under each tr mysql database using php. don't know how this. the hierarchy this: tr-->td-->div(many)-->input fields(many) chkbox,textarea,radio,input deadline project nearing , stucked upon this. have tried using serialize values of input fields? you should able $('tr:selected').serialize() it'd easier if had kind of jsfiddle example of problem.

sql - Count of occurrences per row ignoring the duplicates -

basically, want know sql equivalent of excel's countif(range,criteria) i want output call id | name | phone number | # of occurrences 0001 | name1 | 0000000000 | 2 0002 | name2 | 1111111111 | 1 0003 | name1 | 0000000000 | 2 0004 | name3 | 2222222222 | 2 0005 | name5 | 4444444444 | 1 0006 | name4 | 3333333333 | 1 0007 | name3 | 2222222222 | 2 not output call id | name | phone number | # of occurrences 0001 | name1 | 0000000000 | 2 0002 | name2 | 1111111111 | 1 0004 | name3 | 2222222222 | 2 0005 | name5 | 4444444444 | 1 0006 | name4 | 3333333333 | 1 this simplified table. complex table , result result what wanted avoid having 2 appointments, instead, list them in separate rows appointment 1 here query select a."call id" "call id", conca

unicode - How to test for Greek Letters in java -

so program requires me test greek letter delta. i've found unicode value \u0394 translates δ. statement not run, meaning not read delta. here getxunit returns string value of unit, should delta, when printed returns ?. if(getspectrum().getxunit().equals("\u03b4"){ //do stuff } how accomplish this?

java - Synchronization method -

i tried create 5 threads, accordingly if 1 thread invokes synchronized method on 1 object(objsyn in case) other threads should wait till thread finishes object. output should come thread 1 thread 5 in order. output coming out of order. class synctest extends thread { public synchronized void display() { try{thread.sleep(5000*((long)(math.random())));} catch(exception e){} system.out.println("from synchornized thread "+ thread.currentthread().getname()); } public synchronized void run() { synctest objsyn = new synctest(); objsyn.display(); } public static void main(string args[]) { synctest objsy = new synctest(); thread t1 = new thread(objsy,"thread 1"); thread t2 = new thread(objsy,"thread 2"); thread t3 = new thread(objsy,"thread 3"); th

Why my shell script doesn't work in Alfred 2 Workflow -

i wrote script this, #!/bin/sh hexo=/users/cinvro/nvm/v0.10.15/bin/hexo cd ~/work/hexo/cinvro.com/ $hexo generate it works when execute in terminal,but doesn't work when put in alfred2 workflow. hexo here node.js program. it might ~ problem, replace absolute path: #!/bin/sh hexo=/users/cinvro/nvm/v0.10.15/bin/hexo cd /users/cinvro/work/hexo/cinvro.com/ $hexo generate

javascript - Having multiple imageLoaded calls on 1 page and making sure each call is complete before progressing -

i have 3 sections on page contain lots of images of various sizes, need make sure each of these 3 sections images have loaded before continue applying transitions etc fading sections in etc. i think know need i'm not sure execute it. need create deferred object monitors each of these calls when complete resolve deferred object , run deferred.when or deferred.done method, sound right? i'm not sure how this? i'm using imagesloaded plugin , code looks this: js $(function () { var def1 = $.deferred(); var def2 = $.deferred(); var def3 = $.deferred(); var def = $.when(def1, def2, def3); $('.set1').imagesloaded(function () { console.log('set 1 ready'); def1.resolve(); }); $('.set2').imagesloaded(function () { console.log('set 2 ready'); def2.resolve(); }); $('.set3').imagesloaded(function () { console.log('set 3 ready'); de

asp classic - vbscript won't return multidimensional array -

this getting annoying. following method contained in custom database class. query data recordset try convert data array w/o field names. appears working within function because setup response.write check if there values. once out of function, things go haywire (the array not same). public function to2array() dim a, x, columns columns = rs.fields.count rs.movefirst() x = 0 until rs.eof redim a(x+1,columns) y = 0 columns - 1 a(x,y) = rs.fields.item(y) response.write a(x,y) 'returns correct value next x = x + 1 rs.movenext() loop to2array = end function i assign return array there appears nothing. arr = db.to2array() response.write(arr(1,0)) 'returns nothing can figure out i'm doing wrong? you can grow last dimension of vbscript array. need colsxrows array. to keep 'old' part of dynamic array, must redim preserve. to 2 dimensi

javascript - Trouble adding horizontal scroll on dynamic table -

i'm trying following in javascript: if (parseint($('#' + tablename + 'table').width()) > parseint($('#' + tablename + 'table').parent().width())) { console.log("here"); $('#' + tablename + 'table').css('overflow-x', 'scroll'); } and it's logging console there no horizontal scroll bar... change $('#' + tablename + 'table').css('overflow-x', 'scroll'); to $('#' + tablename + 'table').parent().css('overflow-x', 'scroll'); the parent element 1 needs overflow-x property. also don't need javascript functionality. can set overflow-x: auto; parent element, , add scrollbar automatically if contents wide.

jquery - Bootstrap typeahead inside Durandal SPA application -

i have spa application using default durandal package set-up. using knockout, jquery, jquery ui, , trying use twitter bootstrap typeahead. building on default durandal pages using html on shell.html(navbar) <form class="navbar-search pull-right"> <input type="text" class="search-query" id="employeesearch" placeholder="search employees" data-bind="typeahead: employees"> </form> in order use typeahead custom knockout binding using answers provided here creating autocomplete field typeahead in durandal framework i creating own datasource in connected js file here this.employees = function () { var self = this; $.ajax(app.url('/employees'), { contenttype: 'application/json', datatype: 'jsonp', success: function (result) { self.employees = result; } }); }; var shell = { router: router, employees: employee

java - Is it possible to map POJO fields with names different from the table columns? -

i relatively new ibatis. know upgraded mybatis, reason have use ibatis. question "is possible map pojo fields names different table columns?" i have table, mapping file, , pojo class. can read data if pojo class has names same columns in table, if name field else, not work. changed corresponding getter , defined resultmap in mapping file following <resultmap id="result" class="subscriber"> <result column="advisorid" property="id" jdbctype="integer"/> <result column="firstname" property="firstname" jdbctype="varchar"/> <result column="lastname" property="lastname" jdbctype="varchar"/> <result column="emailid" property="emailid222" jdbctype="varchar"/> </resultmap> <select id="getall" resultmap="result"> select advisorid,firstname,lastname,emailid c

c# - Cross GUI Thread Drag Drop operation -

i have application 3 forms. 2 of forms have grid controls running on separate gui threads. understand running separate gui threads not norm performance requirements forcing me adopt path. third form has set of items in listview box can dragged , dropped on other 2 forms.the problem i'm having implementing drag/drop functionality. had application running on single gui thread , drag/drop worked fine then. since separating them out, i'm having issues cross thread operation. here sample of code. private void grid1_dragdropcontent(object sender, dragdropcontenteventargs e) { if (e.content == null) { if (e.data.getdatapresent(typeof(listview.selectedlistviewitemcollection))) { e.effect = dragdropeffects.copy; listview.selectedlistviewitemcollection items = e.data.getdata(typeof(listview.selectedlistviewitemcollection)) listview.selectedlistviewitemcollection; // code breaks he

vb.net read string after certain character -

i have listbox has random urls + basic info, eg: [search website] - http://www.google.com/ [games website] - http://www.miniclip.com/ each line item. when try use code, crashes: private sub doubleclickitem(sender object, e eventargs) handles listbox1.doubleclick dim url string = listbox1.selecteditem process.start(url) end sub the error the first characters unknown process.start . how can start url? told me have read lines after first " - ". right? if so, how can so? this should it: url = url.substring(url.lastindexof(" - ") + 3)

javascript - How to safetly replace the value after the "td" tag? (In JQuery) -

this question has answer here: how can change element's text without changing child elements? 12 answers inside "td" tag, how replace "bmw" word after "span" tag without removing whole "span" tag script? (in jquery). the word "bmw" wildcard wording. can "ford", "volvo", etc. i'm using jquery version 2.0 $('#'....).??? <td> <span column="17" style="cursor:pointer"></span> bmw </td> just use nextsibling if text node next sibling in question: $('span[column="17"]').get(0).nextsibling.nodevalue = 'volvo'; fiddle

Grails - Update button outside the form -

how can update data other form. ? created button not update data. <html> <head> <meta name="layout" content="main"> <g:set var="entityname" value="${message(code: 'product.label', default: 'product')}" /> <title><g:message code="default.edit.label" args="[entityname]" /></title> </head> <body> <div id="wyszukaj"> <g:form method="post"> <div class="fieldcontain" ${haserrors(bean: productinstance, field: 'symbolindeksu', 'error')}"> <label for="symbolindeksu" style="width: 152px;"> <g:message code="product.wyszukajsymbolindeksu.label" default="symbol indeksu" /> </label>

center - CSS left text, centered image in table -

i'm pretty new css , cannot figure out how accomplish following. have tabular data. of data elements have images associated them. want text in cell left justified , want images in same cell centered. in other words, want same result following except inside table cell. <p>some text.</p> <img style="display:block;margin-left:auto;margin-right:auto;" src="myimage.jpg"/> how can accomplish this? when try placing inside td element, both text , image @ left side. to use margin center element need have set width: <p style="text-align: left;">some text.</p> <img style="display:block;margin-left:auto;margin-right:auto; width:200px;" src="myimage.jpg"/> also, consider putting styles in external stylesheet , use selectors target elements.

java - Spring PropertyPlaceholderConfigurer Issue to Load A Properties File -

i'm trying use external properties file populate of beans in spring application context configuration file. when don't use ${} properties , hardcode jpavendoradapter class property below, can see file loaded in log file. if u rely on properties file , use class="${jpa.vendor.adapter}" notation, cannot find class [${jpa.vendor.adapter}] bean name 'jpavendoradapter' defined in class path resource [spring/applicationcontext.xml]; exception. file definetly on classpath @ runtime, seems loaded after needed. i've tried using <contextroperty-placeholder/> approach, got same exception. i'm using spring version 3.2.2.release, ideas? applicationcontext.xml <beans xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance"

.net - Is using of MemoryMappedFile instance, opened by MemoryMappedFile.OpenExisting method threadsafe? -

in wcf service need provide functionality of files downloading supporting of range http header chunked downloading. first call getfile method of service creates new memorymappedfile instance file on disk. let's assume in time when mmf created first request , request still processing, second call getfile method of service opening existing mmf , returning streamed response client. happens if mmf disposed (and source file closed on memorymappedfile disposing) thread create it? should second call read content opened viewstream or no? i had wrote small test , seems till memorymappedfile opened openexisting method, it's lifetime extended , source file keeps opened. true, or missed pitfall? can't find documentation such case in msdn. update : added additional thread.sleep call after existing mmf opened before obtaining mapview of file simulate threads race private static readonly string mapname = "foo"; private static readonly string filename = @"some

delphi - How to start my Windows Service at RunTime or at OnAfterInstall -

history i building windows service part of platform application handle updates , server functions, can installed in machines different client application installed. uses udp send , receive broadcast messages, , tcp to handle more sensitive , important messages. objective i want application installed end user, copying executable files in computers , when executing them. main application should verify if user administrator, create configuration files, , install windows service , run it, when non administrative users log in, won't receive error application regarding administrative rights. goal make configurations without need present technician, since database remote. problem my service being installed command myservice.exe /install not starting automatically. way start go on control panel > admin tools > services , manually. tryed call net start myservice through application receive invalid service name @ shell. tryied executable name , display name , obj

jquery - Why I can't see these js errors in console -

reviewer says there these 2 errors in wordpress theme. don't know why can't see these errors in browser consoles. i've added define('wp_debug', true); define('script_debug', true); in wp-config.php . these errors can't see in console. uncaught syntaxerror: unexpected token < jquery.flexslider-min.js:4 uncaught typeerror: object [object object] has no method 'flexslider' main.js?ver=3.6:19 try browser. first open console , if don't see errors try reloading page. error may generated when page loads. if using safari , if cannot see error click button within console.

c++ - Lambda returning a reference causes a segmentation fault - why? -

the following code taken straight out of 1 of projects . first version causes crash (segmentation fault). second version works intended. aren't 2 code snippets equivalent? this 1 crashes auto getuserfrompacket = [&](sf::packet& mp) -> user& { return users.getuser(ssvuj::as<std::string>(getdecompressedpacket(mp), 0)); }; phandler[fromclient::us_death] = [&](clienthandler&, sf::packet& mp) { getuserfrompacket(mp).stats.deaths += 1; // segmentation fault here! }; this 1 works phandler[fromclient::us_death] = [&](clienthandler&, sf::packet& mp) { users.getuser(ssvuj::as<std::string>(getdecompressedpacket(mp), 0)).stats.deaths += 1; // works fine }; compiler used: clang++ 3.4 - couldn't deduce return type of getuserfrompacket . users instance of userdb . function signature user& userdb::getuser(const std::string&) - why compiler fail deduce user& return type?

html5 file upload issue with iOS -

i'm having issues using html5 upload files in ios. on desktop can happily select multiple files , upload them. on ios 6.0 (the ios i've tested) if try , upload 2 files uploads first image twice. true whether have been selected in same input, or if form includes different inputs. form has more 1 file, first file repeated, replacing other files. this code below , similar code multiple input fields work on android chrome, windows ie, windows chrome, & mac firefox. <form class="upload" action="uploadservlet" method="post" enctype="multipart/form-data"> <fieldset> <input id="filename" type="file" name="file" size="10" multiple/> <input id="submitbutton" name="submit" type="submit" value="submit"/> </fieldset> </form> the same issue different code related multiple uses of camera: <form c

Running into error when updating core data model object (iOS) -

i running weird error when try , update core data object (null error). first time save object (restaurant) saves perfectly. however, when try , update restaurant - running errors: restaurantdetailviewcontroller.h : @class restaurant; @interface restaurantdetailviewcontroller : uitableviewcontroller <uinavigationcontrollerdelegate, uitextviewdelegate, cuisinepickerviewcontrollerdelegate> @property (nonatomic, strong) iboutlet uitextview *reviewtextview; @property (nonatomic, strong) iboutlet uilabel *cuisinelabel; @property (nonatomic, strong) iboutlet uilabel *datelabel; @property (strong, nonatomic) iboutlet uilabel *addresslabel; @property (nonatomic, copy) nsstring *name; @property (nonatomic, copy) nsstring *address; @property (nonatomic, assign) double longitude; @property (nonatomic, assign) double latitude; @property (nonatomic, assign) cllocationcoordinate2d coordinate; @property (nonatomic, strong) nsmanagedobjectcontext *managedobjectcontext; @property (non

jquery - SignalR error converting value -

first time working signalr , i'm running issues. i'm trying asynchronously update jtable once user adds new user system. problem is, every time try submit, run error below. i'm not sure problem is, data needed populate createusermodel passed through. thoughts i'm doing wrong? the error {"i":"0","e":"error converting value \"userid=19&firstname=123&lastname=123&username=123&role=admin&password=123123&confirmpassword=123123&emailaddress=fakeemail%40gmail.com&phonenumber=123\" type 'myproject.models.createusermodel'. the model i'm trying convert to public class createusermodel { public int userid { get; set; } public string username { get; set; } public string password { get; set; } public string confirmpassword { get; set; } public string firstname { get; set; } public string lastname { get; set; } public string emailaddress { get; set; } public stri

c# - How to convert type 'byte[]' to 'System.Data.Linq.Binary' -

i have workflowinstances table in db contains fields: id (int), name (nvarchar(50), workflowid (int), document (varbinary(max) )). want insert new workflowinstance wrote code stream mystream = openfiledialogdoc.openfile(); if (mystream != null) { using (mystream) { workflowinstance w = new workflowinstance(); byte[] bytes = new byte[mystream.length]; mystream.read(bytes, 0, (int)mystream.length); w.id = repository.workflowsrepository.getmaxidwokflowinstance() + 1; w.name = textboxworkflowinstancename.text; w.currentstateid = repository.workflowsrepository.getworkflowfirststate((int)listboxmyworkflows.selectedvalue); w.workflowid = (int)listboxmyworkflows.selectedvalue; w.creationdate = system.datetime.now.tostring(); w.document = bytes;

android - Display contacts name and phone number in multiautocomplete textview -

i have multiautocomplete textview autocompletes when user types on box respect data query on contactscontracts using content resolver. wanted display name , number on 1 list. here code name_val = (string[]) c_name.toarray(new string[c_name.size()]); phone_val= (string[]) c_number.toarray(new string[c_name.size()]); arrayadapter<string> adapter = new arrayadapter<string>(getactivity(),r.layout.custom_dropdown, name_val); txtphoneno.settokenizer(new multiautocompletetextview.commatokenizer()); txtphoneno.setadapter(adapter); unfortunately displays name. wanted display number after the contacts name. you should use custom adapter or simple adapter custom view

php - Getting Newest Records from MySQL (7 days) -

i trying grab newest records table. want of records happened in past 7 days. here have far start with. $query = "select * mlg_logattempts a.ts = (select max(ts) mlg_logattempts b b.ts > now() - interval 5 minute , b.name = a.name)"; i have used intervals in past unsure how make work now. can show me proper way request past 7 days records? have timestamp field. update unfortunately realized command shared you. not have of above fields. date field have "date". no or ts. you use mysql date_diff() dates http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html#function_datediff but since use timestamps, interval solution: b.ts > unix_timestamp(curdate()-interval 7 day)

algorithm - How to calculate difficulty metric? -

note: have changed original question! i have several texts, consists of several words. words categorized difficulty categories 1 6, 1 being easiest 1 , 6 hardest (or common least common). however, not words can put these categories, because countless words in english language. each category has twice many words category before. level: 100 words in total (100 new) level: 200 words in total (100 new) level: 400 words in total (200 new) level: 800 words in total (400 new) level: 1600 words in total (800 new) level: 3200 words in total (1600 new) when use term level 6 below, mean introduced in level 6. part of 1600 new words , can't found in 1600 words level 5. how rate difficulty of individual text? compare these texts: an easy one would consist of basic vocabulary: i drive car. let's these 4 level 1 words. a medium one this old man cretinous. this basic sentence comes 1 difficult word. a hard one would have advanced vocabulary in there too

javascript - Prevent F11 keydown on iframes on page? -

i have several iframes in popup window each target of form posts different sites. i have following prevent f11 keydown on document: document.onkeydown = function () { if (event.keycode == 122) { event.keycode = 0; return false; } } goal: prevent user viewing url before , after iframe loads. question: there better alternative meeting goal instead of handling keydown event? possible handle such event iframe holds contents of domain? possible still listen , prevent onkey events on iframe eventhough iframes incapable of having onkey attributes? the solution should vanilla js or use little jquery references possible.

jsf - Will <h:inputHidden> tag do the html encoding for the attribute value it renders? -

will <h:inputhidden> tag html encoding attribute value renders? i cannot find documentation on this. in jsf, everything html-encoded, unless explicitly set escape="false" attribute on tag/component supporting attribute (such <h:outputtext> ). this covers value of <h:inputxxx> component. see also: csrf, xss , sql injection attack prevention in jsf

perl - Pattern matching consecutive characters -

i have list of strings search through , ignore contain or g characters occur more 4 times consecutively. instance, ignore strings such tcaaaatc or gctggggaa. i've tried: unless ($string =~ m/a{4,}?/g || m/g{4,}?/g) { something; } but error message "use of uninitialized value in pattern match (m//)". any suggestions appreciated. by writing || m/g{4,}?/g you implicitly testing $_ against regex. but, $_ not initialized, error. write unless ($string =~ m/a{4}/ || $string =~ m/g{4}/) instead (note simplifications made regex), or, single expression, unless ($string =~ m/a{4}|g{4}/)

JNLP crashes after upgrading to Java 1.6 -

i upgraded java 1.4 1.6 version , weblogic 8.1 weblogic 10.3.6 . i'm trying deploy jnlp using java webstart 1.6 , weblogic 10.3.6 env loads java console window , shuts down. explain reason here? my jnlp file follows <?xml version="1.0" encoding="utf-8"?> <jnlp codebase="http://nykpsr0165:18503/eas/workflow/editor/"> <!-- url site containing jnlp application. should match value used on export. href, name of file --> <!-- changed test security issue --> <offline-allowed/> <!--request permissions application. not change--> <security> <all-permissions/> </security> <!-- name of main class execute. not change--> <application-desc main-class="org.eclipse.core.launcher.webstartmain"> <argument>-nosplash</argument> </application-desc> <resources> <!-- reference startup.jar. not change --> <jar href="startu