Posts

Showing posts from July, 2011

ios - How to share or save Audio after Effects, like altering pitch or rate? -

basically, need here that, after app has recorded audio, have written code alters pitch and/or rate, , use activity view controller, share audio app other medias. but, happens, when share that, "original recorded" audio shared, instead of audio had "effects" rate or pitch. so, go sharing (itd awesome, if tell me how save share) audio. example code: //for fast rate playback @ibaction func fasteraudio(sender: uibutton) { audioengine.reset() audioplayer.currenttime = 0 audioplayer.rate = 1.75 audioplayer.play() } //for higher pitch @ibaction func highpitchaudio(sender: uibutton) { audioplayer.stop() audioengine.stop() audioengine.reset() audioplayer.currenttime = 0 var audioplayernode = avaudioplayernode() audioengine.attachnode(audioplayernode) var changepitcheffect = avaudiounittimepitch() changepitcheffect.pitch = 1000 audioengine.attachnode(changepitcheffect) audioengine.connect(audioplayerno

c# - How to enforce a one to one relationship in Entity Framework + SQL Server -

building own mini cms end in ef + sql server (database first). have "contents" table entities link using foreign key. create table [dbo].[contents]( [contentid] [int] identity(1,1) not null, [contenttype] [varchar](100) not null, [dateadded] [datetime] not null, [dateupdated] [datetime] null, [isdeleted] [bit] not null, [userid] [int] not null create table [dbo].[articles]( [articleid] [int] identity(1,1) not null, [contentid] [int] not null, [imageid] [int] not null, [articleheadline] [varchar](250) not null, [articlesummary] [nvarchar](200) not null, [articlebody] [nvarchar](500) not null alter table [dbo].[articles] check add constraint [fk_articles_contents] foreign key([contentid]) references [dbo].[contents] ([contentid]) in entity framework entity content quite rightly thinks 1 many relationship. how go making 1 one? content can belong 1 other entity keep having use first() in code. <h1>@model.content.articles.first().articleheadline</h1> @htm

mysql - LEFT JOIN shows different results from RIGHT JOIN - when joining table on itself... why? -

i have single taxonomies table parent->child hierarchical data. thought queries post below should return identical result because i'm joining same table on - i'm getting different results. why? here's left join query , it's result: select a.id cat_id, b.id subcat_id, a.name cat_name, b.name sub_cat_name, concat_ws(' / ', a.name, b.name) full_name taxonomies left join taxonomies b on a.id = b.parent_taxonomy_id (a.name 'se%' or b.name 'se%') order full_name desc; +--------+-----------+----------+--------------+--------------------+ | cat_id | subcat_id | cat_name | sub_cat_name | full_name | +--------+-----------+----------+--------------+--------------------+ | 84 | 85 | season | winter | season / winter | | 84 | 91 | season | summer | season / summer | | 84 | 90 | season | spring | season / spring | | 84 | 128 | season | fall | season /

actionscript 3 - Create round corner video object -

i want create rounded corner video object video player. how create object: var videocamera:video = new video(300, 225); the problem make object square video. want corner of object round instead of square. have searched lot on google , not find example or fix problem. i did this, dont work.. videocamera.graphics.linestyle(5, 0x00ff00, 1); //last arg alpha videocamera.graphics.beginfill(0xff0000, 1); //last arg alpha videocamera.graphics.drawroundrect(0, 0, 100, 100, 25, 25) videocamera.graphics.endfill(); addchild( videocamera); please me make video object have rounded corner. to looking for, can use mask , : var video:video = new video(320, 180); video.x = video.y = 50; addchild(video); var rounded:shape = new shape(); rounded.graphics.beginfill(0xff0000); rounded.graphics.drawroundrect(video.x, video.y, video.width, video.height, 25, 25); rounded.graphics.endfill(); addchild(rounded); video.mask = rounded; that's ! hope can help.

git - Why wont it let me commit my submodules? -

so did: git submodule foreach git submodule foreach git pull origin master and got huge out put pulled , updated these submodules latest , greatest. did: vagrant@vagrantpress:/vagrant/freya-vagrant$ git status on branch master branch up-to-date 'origin/master'. changes not staged commit: (use "git add <file>..." update committed) (use "git checkout -- <file>..." discard changes in working directory) (commit or discard untracked or modified content in submodules) modified: local-dev/content/mu-plugins/freya-mu (modified content) modified: local-dev/content/themes/freya-theme (modified content) no changes added commit (use "git add" and/or "git commit -a") vagrant@vagrantpress:/vagrant/freya-vagrant$ git commit -a on branch master branch up-to-date 'origin/master'. changes not staged commit: modified: local-dev/content/mu-plugins/freya-mu (modified content) modifi

What is wrong with this go switch statement? -

can see why switch won't work? func main() { reader := bufio.newreader(os.stdin) text, _ := reader.readstring('\n') fmt.print(text) switch text { case "a": fmt.print("a\n") case "b": fmt.print("b\n") case "c": fmt.print("c\n") default: fmt.print("default\n") } } in statement, default value returned yet when hard coding switch expression, switch block works should. looking @ readstring() func code, returns string can't see reason example not work. am doing wrong?! your text consists of 2 bytes: fmt.print(len(text)) 2 , fmt.print(len("a")) one. you second symbol invisible , can try remove text = strings.trimspace(text) .

c# - Getting "Cannot access file exception -

i getting following exception. "comexception unhandled" "can not access file_name.xls" string currentdir=directory.getcurrentdirectory(); if (defaultbuttonclicked) { _csvfilepath = path.combine(currentdir, "file name_" + datetime.now.adddays(-1).tostring("mm-dd-yyyy") + ".xls"); defaultbuttonclicked = false; } else if (datespecificsearchbuttonclicked) { var datetemp = calchoosedate.value.tostring("mm-dd-yyyy"); _csvfilepath = path.combine(currentdir, "file name_" + datetemp + ".xls"); datespecificsearchbuttonclicked = false; } workbook.saveas(_csvfilepath, excel.xlfileformat.xlopenxmlworkbook, type.missing, type.missing, true, false, excel.xlsaveasaccessmode.xlnochange, type.missing, type.missing, type.missing, type.missing, type.missing); workbook.close(true, misvalue

html - drop down select option form and pagination error php -

i have form select option, loops , uses pagination break 5 select options per page. whenever user selects options on several different pages, options selected on last page before submitting form processed. research on issue has been suggesting using ajax or javascript. idea, how can go - if possible using php alone. <form method="post" action="consel.php"> <?php $sql = "select * games startunix > '$nowtime' order starttime limit $offset, $rowsperpage" ; $retval = mysql_query($sql); while($row = mysql_fetch_array($retval, mysql_assoc)) { echo "<div align='center'><span class='style3'>{$row['home']} vs ". "{$row['away']} </span></div>". "<font color='#000000' size='2'>{$row['country']} | {$row['league']} | time:{$row['starttime']} </font> <br>

java - Number Regular expression check fails -

i need check expression contains 2 digits slash , 3 digits. have coded following test in java: string s="11/111"; system.out.println(s.matches("d{2}/d{3}")); the method matches returns true if regex matched.however check returns "false". what's wrong regular expression ? a digit matched \d , not d : s.matches("\\d{2}/\\d{3}")

Jquery+(Regex?) Replace text with img from string -

i want replace text img using part of itself: <li class='custom'> <legend>images:</legend> {[img.png][1desc][2desc]} {[img2.png][1desc2][2desc2} </li> i want appear this: <li class='custom'> <legend>images:</legend> <img src="img.png" title="1desc - 2desc"/> <img src="img2.png" title="1desc2 - 2desc2"/> </li> current code using(doesn't work): <script> function texttoimg(theimg) { return theimg.replace( /\{\s*[\s*(.*?)\s*]\s*[\s*(.*?)\s*]\s*[\s*(.*?)\s*]\s*\}/gi, '<img src="$1" title="$2 - $3"/>' ); } jquery('li.custom').each(function() { current = jquery(this); img = texttoimg(current.html()); current.html(img); }); </script> i haven't done jquery bit, since have been constructing solution on rather old ipod, regexp part trick. first

php - Scrape web page contents -

i developing project, want scrape contents of website in background , limited content scraped website. example, in page have "userid" , "password" fields, using access mail , scrape inbox contents , display in page. please me solve problem, in advance. i done above using javascript alone . when click sign in button url of page( http://localhost/web/login.html ) changed url( http://mail.in.com/mails/inbox.php?nomail=....)which scraped . scrap details without changing url. please me find solve problem,thanks in advance.. definitely go php simple html dom parser . it's fast, easy , super flexible. sticks entire html page in object can access element object. like example of official site, links on main google page: // create dom url or file $html = file_get_html('http://www.google.com/'); // find images foreach($html->find('img') $element) echo $element->src . '<br>'; // find links foreach($html-&g

assembly - GNU as .macro placeholder immediately followed by character -

in gnu assembler, defined macro this. .macro test_cond condition, index str\conditionb r4, [r6, #\index*17] .endm test_cond eq, 0 it supposed expand to streqb r4, [r6, #0*17] instead fails with bad instruction `streq\conditionb r4,[r6,#0*17]' is there way have placeholder in macro followed character? use \() construct separate macro argument character follows it: .macro test_cond condition, index str\condition\()b r4, [r6, #\index*17] .endm

java - When using "bundle" packaging with maven-bundle-plugin goals are executed twice -

i have (simple) maven project packaging type "bundle" using org.apache.felix:maven-bundle-plugin:2.5.4 . produces correct osgi bundle jar. observe goals executed @ least twice . how prevent this? problem goals (checkstyle in example) slow duplicate execution problem here. note : use maven 3.2.5 command line. output or mvn clean install (removed irrelevant info). notice many plugins executed 4 times. maven-checkstyle-plugin execurted twice. [info] --- maven-clean-plugin:2.5:clean (default-clean) @ my-project --- [info] --- maven-enforcer-plugin:1.4:enforce (enforce-maven) @ my-project --- [info] --- maven-resources-plugin:2.7:resources (default-resources) @ my-project --- [info] --- maven-compiler-plugin:3.3:compile (default-compile) @ my-project --- [info] --- maven-resources-plugin:2.7:testresources (default-testresources) @ my-project --- [info] --- maven-compiler-plugin:3.3:testcompile (default-testcompile) @ my-project --- [info] --- maven-surefire-plugin:2.18

ruby on rails - ActiveRecord - How to `select` polymorphic join as a boolean? -

i've been banging head against wall attempting come query, figured time post here. i have class called flair -- it's polymorphic, since lots of things can have flair: class flair < activerecord::base belongs_to :flairable, polymorphic: true, touch: true belongs_to :user end and comment has many flairs : class comment < activerecord::base has_many :flairs, as: :flairable end when getting list of comments, want know ones have flair belongs given user. the best i've been able come far is # don't worry interpolation; example # , assume have valid @comments , user_id @comments.select('comments.*'). select('flairs.id has_flaired'). joins("left join flairs on flairable_id = comments.id , flairs.user_id = #{user_id}") but returns 1 result every flair on comment (as expected left join), multiplying number of appearances of each comment in array number of flairs has. i've tried using distinct on (user_id)

mlogit - Multistage Nested Logit R -

i want estimate nested logit model using language r. standard packages such problems using "mlogit". estimate model, more 1 stage. problem follows: stage: people decide, if want migrate or not. stage: people decided migrate, have decide in region of want go (us devided in 6 regions) stage: within region, decide in kind of area want live; urba vs. rural i transformed data using mlogit.data(). data <- mlogit.data(data = usa_canada_uk, choice = "migrant")) this how "data" looks: sex marst numperhh_cat age_cat famsize nchlt5 labour_code sample nchlt10 3888.no female married 1-5 16+ 1 no chiled aged 5 or younger not working 8262 no chiled aged 10 or younger 12874.no female married 1-5 16+ 2 or more @ least 1 child aged 5 or younger ancillary 8262 @ least 1 child aged 10 or younger 13084.no female married

r - Twitter app is not getting started -

i have written following script extract tweets twitter. library("twitter") library("roauth") library("rcurl") library("httr") download.file(url="http://curl.haxx.se/ca/cacert.pem",destfile="cacert.pem") ck <- '4qpoqjoibgogp7ju13akxfp2e' cs <- 'ued02vupial3k8nw8foectzj1uftsefqetqjbyxd21ucj0ohjc' ak <- '136316586-xwncmre5uyszigtowtvyr4nh4gfr01adpr5sf5ik' <- 'zsij4lsdc5xkcdyofwkyijknuy8uj71sg1nfaifkzbgc2' requrl<- 'https://api.twitter.com/oauth/request_token' acurl <- 'https://api.twitter.com/oauth/access_token' auurl <- 'https://api.twitter.com/oauth/authorize' cred <- oauthfactory$new(consumerkey=ck,consumersecret=cs,requesturl=requrl,accessurl=acurl,authurl=auurl) cred$handshake(cainfo="cacert.pem") save(cred, file="twitter_authentication.rdata") load("twitter_authentication.rdata") oauth_endpoints("twitter&

visual studio - How to create a sfx with progressbar by sevenzipsharp in C# -

Image
i want create sfx file c# winforms. have downloaded sevensharp https://sevenzipsharp.codeplex.com . not step step tutorial this. similar question got stackoverflow , other site, didn't work , showing error. want add custom in sfx, when user double click "file_sfx.exe" custom form shown , ask password. i added "sevenzipsfx.cs" class, "sevenzipsharp.dll" reference, , copied "7z.dll" output folder of visual studio. sample code: private void button2_click(object sender, eventargs e) { sevenzipcompressor.setlibrarypath("7z.dll"); sevenzipcompressor sevenzipcompressor = new sevenzipcompressor(); sevenzipcompressor.compressionlevel = sevenzip.compressionlevel.ultra; sevenzipcompressor.compressionmethod = compressionmethod.lzma; sevenzipsfx compressor = new sevenzipsfx("7z.sfx"); compressor.makesfx(@"e:\cm1.7z", @"e:\cm1.exe"); } error:

java - How to handle error responses using spring rest client -

i trying better handle bad responses when using sprint rest client. code follows: responseentity<foo> response = null; try { response = resttemplate.exchange(uri, httpmethod.get, new httpentity<>(new httpheaders()), foo.class); catch (restclientexception rce) { //what here? } this works great long there no error. problem when corresponding web service returns error (or times out), exception. there no enum status code handle wish. error message useful. not. usually, if corresponding server returns html error page, message object cannot created, specific error swallowed. any ideas? what can rce.getmostspecificcause() ? maybe there more information. you can catch httpstatuscodeexception direct subclass of restclientexception more generic. there lot of exceptions can catch more specific restclientexception e.g. public class httpservererrorexception extends httpstatuscodeexception exception thrown when http 5xx rec

javascript - Adding duplicates to SailsJS model with many-to-many association -

i have 2 models, items , order, have many-to-many association. i've been trying past 5 hours figure out way add multiple items objects order including duplicates. if items unique works fine, if try this: order.items.add([12, 13, 12, 12]); order.save(); it save 12, 13. duplicates ignored, not if want order more 1 of item. any suggestions helpful. many-to-many association in db scheme creating relation between record table record table, of course unique, because 12 has association order record. the solution is, use model achieve that. example, in models folder: order.js module.exports = { attributes: { items : {collection: 'orderitem', via: 'order'} } }; orderitem.js module.exports = { attributes: { order : {model: 'order'}, item : {model: 'item'} } }; item.js module.exports = { attributes: { } }; so order model, can add orderitem model represent relation between order ,

Android Retrofit change request method GET or POST dynamically -

i migrating android application traditional way retrofit. it's awesome while playing it. but, application's existing functionality is having global settings page change request method or post requests (for server side logs while debugging). public static boolean isusingpost(context context) { sharedpreferences prefs = context.getsharedpreferences(pref_name, 0); return prefs.getint("http_request_method", 0) == 0; } //check or post boolean usehttppost = isusingpost(); if (usehttppost == false) { //get httpget httpget = new httpget(url); response = httpclient.execute(httpget); } else { //post httppost httppost = new httppost(url); response = httpclient.execute(httppost); } in retrofit: define request method or post before call: @get("/getversion") void getversion(callback<loginresponse> callback); should maintain 2 methods??!!! @get("/getversion") void getversionget(callback<loginresponse>

android - ArrayList remove(0) when size > 0 -

i trying first item in arraylist items using items.remove(0), works fine till items.size() 1, @ point code below returns empty string. tired 2 different ways not know why returning "" when expect return last remaining item when items.size > 0. step on using android studio, debugger steps on both return lines in second code. never seen before. please solve this. thank you string item = ""; if (items.size() > 0) { item = items.remove(0); } return item; if (items.size() > 0) { return items.remove(0); } else { return ""; } why not use .get() method? string item = "b" // items.size() = 1 if(items.size() > 0) { item = items.get(0); } else { item = ""; }

java - Obtain key of a hashmap with a range of numbers as value -

i have hashmap<integer, float> entries: 1 -> 0.127 2 -> 0.167 3 -> 0.207 4 -> 0.247 5 -> 0.237 6 -> 0.327 7 -> 0.367 8 -> 0.407 9 -> 0.447 10 -> 0.487 11 -> 0.527 12 -> 0.567 13 -> 0.607 14 -> 0.647 15 -> 0.652 let suppose want key float 0.465 (which not existing value). 0.465 between 0.447 , 0.487 , key 10 . the first thought came in mind achive 15 if/else if statements or switch statement. in view, wouldn't elegant , practical. is there other way this? a map not appropriate data structure. use treeset instead: treeset<float> numbers = new treeset<>(); // populate set numbers, in order, int index = numbers.headset(n).size() + 1; this perform well: treeset finds insertion point in o(log n) time (like binary search) , list returned view (a new list not created), whole operation lightweight. also note elements don't need added in particular order - treeset internally maintains

mysql - How often should I upload documents to CloudSearch (Solr)? -

here use case: i use mysql primary data store , cloudsearch searching. database contains tables: threads, comments, upvotes, users. i created expression sort search results based on "trending" using upvotes , created_at date (hacker news hot algorithm). expression called "trend", , used in cloudsearch query this: /search?q=superman&sort=trend+desc (upotes-1)/pow(floor((_time-created_at)/3600000)+2, 1.8) right now, when user upvotes thread or comment, stored in mysql database. question how should keep upvotes in sync cloudsearch? the 2 options see: immediately insert (replace) upvote in mysql, update score on cloudsearch. involves sending single document upload on every upvote, ensures real-time accuracy. immediately insert (replace) upvote in mysql, keep upvote in cache somewhere (redis?). once every hour, upload upvotes cloudsearch. what best way handle situation? it depends on lot of things your solr setup, how many servers, h

python - How to append a list of strings -

i append list of string in python below: messages = ["hello","hi"] expected output messages = ["hello","hi","bye"] her example have error : "str object has no attribute "append" " messages = ["really","hey"] user = ["0.0.0.0"] serv.bind(('0.0.0.0',12800)) msg, addr = serv.recvfrom(1024) msg = msg.decode() user.append(addr) messages.append(msg) full code : chat = ['bienvenu dans le chat de dungeons !','welcome on dungeon\'s chat'] user = ["really","hey"] pseudo = ["foo","this"] isconnect = [0] serv = socket.socket(socket.af_inet,socket.sock_dgram) user_tab = 0 serv.bind(('0.0.0.0',12800)) while(1): msg, addr = serv.recvfrom(1024) msg = msg.decode() if (msg.find("[pseudo]")!=-1): firstplace = msg.find("[pseudo]") secondplace = msg.find

oracle - SQL multiple join on two tables -

i novice sql user. i have 2 tables. on has overview information linear features, e.g. feature type, name, etc., table_1. each linear feature exists in 3 spatial zones. second table has x,y locations each linear feature crosses zone zone, table_2. x,y in 2 columns , zone crossed in 3rd. column have tie tables each other name. join x,y information table_1 3 times. column have once each zone. table_1 name type line_1 line_2 b table_2 name zone x y line_1 zone_1 53.36 48.99 line_2 zone_1 4.36 81.38 line_1 zone_2 41.11 93.85 line_2 zone_2 92.86 5.37 line_1 zone_3 3.44 87.41 line_2 zone_3 24.45 78.60 table_out name type x_zone_1 y_zone_1 x_zone_2 y_zone_2 x_zone_3 y_zone_3 line_1 53.36 48.99 41.11 93.85 3.44 87.41 line_2 b 4.36 81.38 92.86 5.37 24.45 78.60 i can 1 zone ok... select

php - Stored image in database doesn't show on page -

image stored in database (as varchar(255)), on page isn't shown. this code stored image, , put's image in folder: if (isset($_files["image"])) { $title = date("dmyhms") . "_" . $_files["image"]["name"]; $path = "img/profile/" . $_post["id"] . "_" . $title; move_uploaded_file($_files["image"]["tmp_name"], $path); } and display image: foreach ($conn->results() $conn): $img = $_server["context_document_root"] . $path . "img/profile" . $conn->id . "_" . $conn->image; if (file_exists($img)) { $image = $path . "img/profile/" . $conn->id . "_" . $conn->image; } else { $image = $path . "img/noimage.png"; } <?php endforeach; ?> when print_r $img, shows right path image , still image not displayed. display: <?php echo $image; ?> where did ec

nexus - Building Mavenized jCuda with maven -

well have installed nvidia driver , cuda 7 , built , run many jcuda (not mavenized) projects in eclipse . but wanted migrate mavenized version one. so, cloned this repository , tried build it. on ubuntu 14.04 x64 , have set nexus , too. when want build mvn clean package got this: downloading: http://localhost:8081/nexus/content/groups/public/jcuda/jcublas/0.7.0a/jcublas-0.7.0a.pom [warning] pom jcuda:jcublas:jar:0.7.0a missing, no dependency information available for of *. poms and after these warnings, build finished unsuccessfully with: could not resolve dependencies project org.mystic:mavenized- jcuda:jar:0.1.2: following artifacts not resolved: jcuda:jcublas:jar:0.7.0a, jcuda:jcuda:jar:0.7.0a ... and lists of jcuda *. jars , *. sos have forgotten something? update : i used option -dmaven.repo.local=repo mvn clean package , every thing ok. yes, i'm 80% sure, because of local nexus failure find jcuda:jcublas:jar:0.7.0a in http://localhos

PHP retrieve data from database and show in text area -

i m trying display retrieved data database in earlier created text area. code supposed users nickname , input message, store both in database , retrieve text area, smth similar 1 man chat (whatever typed after clicking 'send message' should stored database , retrieved , shown in text area). able store database , display retrieved data anywhere outside text area. appreciated. thank you! code: <!doctype html> <html> <head> <meta charset="utf-8"> <title>untitled document</title> </head> <body> <form method="post" action="postmessage.php"> <center> <br /> <label for="output">chat history</label> <br /> <textarea name="output" cols="100" rows="25" id="output"></textarea> <br /> <label for="nickname" maxlength="16">nickname</label> <br

authentication - IT Hit Ajax File Browser - Open OS's File Manager - login prompt -

i noticed 'open os's file manager' feature prompts user login on first access. is possible configure ajax file browser use 'open os's file manager' feature without login prompt? i set user credentials on ajax file browser page (ajaxfilebrowser.getsession().setcredentials) see doesn't pass these credentials 'open os's file manager' feature. in general there no way avoid credentials dialog. reason credentials specify in web browser stored in web browser, when os file manager run there no way share credentials application. the possible solution implementing url-authentiation , pass authentication token in url: http://server/[sessionid1234567890]/path/file.docx

batch file - netsh wlan show drivers (combine 2 commands in 1) -

i want add these 2 commands: netsh wlan show drivers | find "administrator" && msg * "please run administrator" && exit netsh wlan show drivers | find "hosted network supported : yes" || msg * "your wireless network adapter not supported." to make 1 single command 1 netsh wlan show drivers still functions 2 above, if 1st command processed, 2nd not done. please me. netsh wlan show drivers && (netsh wlan show drivers | findstr /i /c:"hosted network supported" || echo not supported) || echo please run admin i don't have wlan think works. it's brackets go. && if previous command exit 0. || if previous command exit non zero.

How do I delete an extension in my Chrome developer dashboard? -

i have uploaded extension dashboard don't want publish more. extension remained "draft" status, , want removed dashboard. however, cannot find way so far. can please? you can't delete extension chrome developer dashboard. in past, there delete button @ dashboard, has been removed because developers accidentally removed apps/extensions (and tried re-upload app/extension same id, failed ). unpublished extensions/apps not count toward extension limit, there no consequences having lot of unpublished apps/extensions besides clutter @ dashboard. if you're bothered entry @ dashboard, create user style, user script or extension hide it.

c# - Selecting a single record to display on a view -

i have controller user can add friends. actionmethods in controller are: [authorize] public actionresult add (string id = "") { var model = _db.users .orderby(r => r.username) .where(r => r.id == id).tolist() .select(r => new friendslist { requesterid = httpcontext.user.identity.getuserid().tostring(), requesteeid = id, username = r.username, status = "newrequest", requestdate = datetime.now, acknowledgedate = datetime.now }); return view(model); } [httppost] [validateantiforgerytoken] public actionresult add (friendslist friendslist) { if (modelstate.isvalid) { _friend.entry(friendslist).state = system.data.entity.entitystate.modified; _friend.savechanges(); return view(friendslist); } } and view code looks like: @model max.models.social.friendslis

java - Address already in use: JVM_Bind. Sockets Chat -

i have program chat sockets, 1 multicast , unicast other, when trying run both following error: java.net.bindexception: address in use: jvm_bind @ java.net.dualstackplainsocketimpl.bind0(native method) @ java.net.dualstackplainsocketimpl.socketbind(dualstackplainsocketimpl.java:96) @ java.net.abstractplainsocketimpl.bind(abstractplainsocketimpl.java:376) @ java.net.plainsocketimpl.bind(plainsocketimpl.java:175) @ java.net.serversocket.bind(serversocket.java:376) @ java.net.serversocket.<init>(serversocket.java:237) @ java.net.serversocket.<init>(serversocket.java:128) @ chat.chatprivado_servidor$hilo.run(chatprivado_servidor.java:47) apparently error in chatprivado_servidor class thread, put them code me please. excuse bad english class chatprivado_servidor class hilo extends thread { string msgin = ""; public void run() { try{ ss = new serversocket(1500); s = ss.accept(); din = new datainputstream(s.getinput

java - Custom Object Arrays and For Loops -

i'm trying make program has array of person objects called "personarray" populated loop reads user input 3 separate variables , turns variables person object , adds array. here code person.java: public class person { private string firstname, lastname; private int zip; public person(string fname, string lname, int perzip) { firstname = fname; lastname = lname; zip = perzip; } } and here code persondriver.java: import java.util.scanner; public class persondriver { public static void main(string[] args) { scanner scan = new scanner(system.in); string firstname, lastname; int zipcode; person[] personarray = new person[25]; (int = 0; < 25; i++) { system.out.println("enter first name: "); firstname = scan.nextline(); system.out.println("enter last name: "); lastname = scan.nextline();

How to do feature selection and reduction on a LIBSVM file in Spark using Python? -

i have couple of libsvm files have implement clustering in spark using python. file has space delimiter , first column represents type [ 1 or -1] , rest features in format [1:2.566]. there lot of columns , perform feature selection on [preferably implement chisquaretest model] , use pca or svd perform feature reduction process. but, not find decent tutorial python in spark implement these processes. i found link online had sample script implement chisqtest in python. used same logic implement model , not done. under hypothesis testing division in link, code parallelizes rdd[labeledpoint] before passing chisqtest model. tried same logic in different manner , got different errors. data = mlutils.loadlibsvmfile(sc, "path/filename.txt") label = data.map(lambda x: x.label) features = data.map(lambda x: x.features) obs = sc.parallelize(labeledpoint(label,features)) this gave me error stating typeerror: float() argument must string or number then, normalized data using

php - how to change simple session login type into facebook style login? -

i stuck in converting login type of web based application..i got code net in app ask username , when enter it, shows conversation page..but want convert login type proper 1 username , password..i designed login system want use..the codes absolutely working when used individually..when combined wont work..can tell me code after combining these two? here's code app index.php <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>chat</title> <link type="text/css" rel="stylesheet" href="style.css" /> <link rel="stylesheet" href="css/style.css"> <style> a:link { color: black; } a:visited { color: black; }</style> </head> <body> <?php session_start(); ?> <div id="wrapper">

java - Hibernate mapping exception: Could not determine type for columns -

Image
i want mapping between 2 classes customer , customergroup , getting error: exception in thread "awt-eventqueue-0" org.hibernate.mappingexception: not determine type for: studyproject.customergroup, @ table: customer, columns: [org.hibernate.mapping.column(assignedto)] my customergroup class is: (fyi: @ beginning don't need bonuspackage type, therefore didn't annotate it) package studyproject; import javax.persistence.column; import javax.persistence.id; public class customergroup { private string name; private string description; private int id; private bonuspackage bonuspackage; public customergroup(int id,string name, string description, bonuspackage bonuspackage) { super(); this.id=id; this.name = name; this.description = description; this.bonuspackage = bonuspackage; } @column(name="id") public int getid() { return id; } public void setid(int id) { this.id = id; } @column(name="name") public