text
stringlengths
0
30.5k
title
stringclasses
1 value
embeddings
listlengths
768
768
"ab", or go to 2." This makes things a bit clearer.
[ 0.37275442481040955, 0.0847802683711052, 0.07741906493902206, -0.2748292088508606, -0.0648653656244278, -0.2329077422618866, 0.5465925931930542, 0.2203887701034546, -0.24424231052398682, -0.4308955669403076, -0.1757173389196396, 0.5110231041908264, -0.13116976618766785, -0.0257880277931690...
I just started learning JavaScript and am wondering why this simple snippet hangs when I click on the "Call function" button. What am I missing? ``` <html> <head> <script type="text/javascript"> function myfunction() { document.write("hello"); } </script> </head> <body> <form> <input type="button" onclick="myfunct...
[ 0.04985719174146652, 0.2755495607852936, 0.524859607219696, -0.28239285945892334, -0.012607365846633911, -0.055610597133636475, 0.1447918862104416, -0.5538674592971802, -0.1548663228750229, -0.5686627626419067, -0.3234732747077942, 0.4086776673793793, -0.21300122141838074, -0.1066943556070...
I had always assumed that a file would leak if it was opened without being closed, but I just verified that if I enter the following lines of code, the file will close: ``` >>> f = open('somefile.txt') >>> del f ``` Just out of sheer curiosity, how does this work? I notice that file doesn't include a `__`del`__` met...
[ 0.11163034290075302, 0.23242168128490448, 0.37163448333740234, -0.20437878370285034, 0.03441460803151131, -0.5457451343536377, 0.017996832728385925, -0.11822499334812164, -0.3344559371471405, -0.3498328626155853, -0.5010573863983154, 0.6292906999588013, -0.30837854743003845, 0.408876746892...
I'm having trouble figuring out how to assign roles to users. I've got the log in mechanism working, but need to figure out how to use roles defined to give users certain access. I have a database with these tables: ``` Tables ------ UserTbl RolesTbl
[ -0.0978650376200676, -0.16444844007492065, 0.34497717022895813, -0.09094581007957458, 0.23151934146881104, 0.28653302788734436, -0.07979446649551392, 0.05441070348024368, -0.11420509219169617, -0.9103070497512817, 0.15973763167858124, 0.6646961569786072, -0.1300714612007141, -0.02637219242...
UserInRoleTbl ------- ---------- ------------- UserID (PK) RoleId (PK) ID (PK) Name RoleName UserId UserName Description RoleId
[ -0.7198253273963928, -0.2550835907459259, 0.5253172516822815, 0.06629714369773865, -0.21209651231765747, 0.23907160758972168, -0.33841875195503235, -0.056886523962020874, -0.15550513565540314, -0.5173997282981873, -0.3177376389503479, 0.07495948672294617, -0.05271915718913078, -0.160312950...
Password Email ``` With this small database I'm testing the ability to assign roles to the user. I'm using `LINQtoSQL` to act as the Data Access Layer. I've created the login mechanism to login to the software, and then I get stuck on what to do next. For Example: > `username = admin,password= admin, RoleId = 1 ;...
[ -0.25556138157844543, 0.0882207453250885, 0.35531315207481384, -0.3203326165676117, 0.14593279361724854, -0.10749876499176025, 0.2576899826526642, 0.04352187365293503, 0.08650728315114975, -0.8204275965690613, -0.1079702377319336, 0.6900457739830017, -0.4230990707874298, 0.0927381515502929...
= new GenericIdentity("admin"); string[] roles1 = { "Administrator" }; GenericPrincipal principal1 = new GenericPrincipal(My2, roles1); Thread.CurrentPrincipal = principal1; } private void LoadWindow(object sender, RoutedEventArgs e) { if (Thread.CurrentPrincipal.IsInRole("Administ...
[ -0.1893678903579712, -0.7002601027488708, 0.4623461663722992, -0.17397695779800415, 0.1200416311621666, 0.022531649097800255, 0.6953226327896118, -0.12781326472759247, -0.29212096333503723, -0.46328961849212646, -0.3283255100250244, 0.6895709037780762, -0.4320615828037262, 0.39333641529083...
} ``` } I implement the code role but there is no connection with database; instead I want to store the role from the database,create a method in C# and write down a code that after user's login to get access to the application. To explain further: I gave `Rolename = Administrator` so if the user is admin he'll get...
[ 0.10378067940473557, 0.28810915350914, 0.43192407488822937, -0.00949886068701744, 0.03165672346949577, 0.055478114634752274, 0.20771928131580353, -0.4761534631252289, 0.07037733495235443, -0.533197283744812, -0.015227122232317924, 0.5741357803344727, -0.19133923947811127, 0.032177072018384...
> [How create role to put in the database?](https://stackoverflow.com/questions/557791/how-create-role-to-put-in-the-database) If you have the "UserTbl" and "RolesTbl" in your database, you should also have two classes called "UserTbl" and "RolesTbl" in your LINQ-to-SQL model. To store a role in the database, instanti...
[ -0.1171003207564354, -0.35098811984062195, 0.5871599316596985, -0.0809013843536377, 0.03853468969464302, 0.29088303446769714, 0.017759226262569427, -0.4353989064693451, 0.16505146026611328, -0.7477138638496399, -0.060757096856832504, 0.5600408911705017, -0.22515355050563812, -0.12225817143...
new UserTbl(); newUser.UserID = "newuser"; newUser.Name = "Some NewUser"; newUser.EMail = "newuser@somewhere.org"; newUser.Password = "TopSecret"; // add new user to the table of users in the data context dc.UserTbls.InsertOnSubmit(newUser); // create new instance of a role RolesTbl newRole = new RolesTbl(); newRole....
[ -0.31978246569633484, -0.2964654266834259, 0.7876225113868713, -0.04874012991786003, 0.056984659284353256, 0.2934761345386505, 0.09924596548080444, -0.24778135120868683, -0.38512057065963745, -0.8869328498840332, -0.2313520312309265, 0.49402233958244324, -0.35250556468963623, 0.42687571048...
I'm looking to create a form on my website where users can enter their email address and a message (however long). Then upon clicking on a submit button, the code, sends the message as an email to my mailbox. I was wondering if someone knew what code i could use. I am using PHP as my server-side language. You need to ...
[ 0.5833005309104919, 0.40445616841316223, 0.6238353848457336, -0.17693836987018585, -0.24513469636440277, 0.18233518302440643, 0.3136902451515198, -0.16141864657402039, -0.2459067404270172, -0.7486345767974854, 0.15759703516960144, 0.019267627969384193, -0.3147498369216919, 0.32308104634284...
the mail..."; //mail body $subject = "Subject for receiver"; //subject $header = "From: ". $Name . " <" . $email . ">\r\n"; //optional headerfields mail($recipient, $subject, $mail_body, $header); ``` The smtp server is set in the php.ini file in these two lines: ``` SMTP = servername smtp_port = 25 ``` More in...
[ -0.11025533080101013, 0.0023538663517683744, 0.7621784210205078, -0.10550493001937866, -0.23493076860904694, 0.11802235245704651, 0.3932344913482666, -0.04197007790207863, -0.2778283953666687, -0.5768560767173767, -0.3822086453437805, -0.027170227840542793, -0.26952600479125977, 0.31370535...
I am building a Links voting site, the formula works ok after the link is voted the second time, the problem is that when the link just has 1 vote it shows up backwards, from oldest to newest. What I want is for links with one vote to show from newest to oldest. This is the line that calls the links in the front page...
[ 0.430721640586853, 0.17264385521411896, 0.6843276023864746, -0.11636414378881454, -0.08585229516029358, -0.13145966827869415, -0.03121986612677574, -0.3945601284503937, -0.30002978444099426, -0.7072955965995789, 0.09102106839418411, 0.24235695600509644, -0.233896866440773, 0.31647178530693...
the * database according subject to * conditions */ $db = null; $results = null; $records = array(); $query = "select id, created, modified, username, url, title, description, points, ranking from articles $conditions"; try
[ 0.15244007110595703, 0.12179906666278839, 0.11259977519512177, 0.10987895727157593, 0.1023443192243576, 0.047139912843704224, 0.5029684901237488, -0.19555619359016418, -0.034580446779727936, -0.3949149250984192, -0.3902450203895569, 0.1837824583053589, -0.5258970856666565, 0.50203001499176...
{ $db = parent::getConnection(); $results = parent::execSql($query); while($row = $results->fetch_assoc()) { $r_id = $row['id']; $r_created = $row['created'];
[ -0.05421987175941467, -0.04149999842047691, 0.35769397020339966, -0.2881270945072174, 0.013932951726019382, 0.29541075229644775, 0.3118686079978943, -0.5051493644714355, 0.16933876276016235, -0.16159687936306, -0.42118167877197266, 0.18228092789649963, -0.36749163269996643, 0.6864821910858...
$r_modified = $row['modified']; $r_title = $row['title']; $r_description = $row['description']; if(!get_magic_quotes_gpc()) { $r_title = stripslashes($r_title);
[ 0.1254836916923523, 0.08575038611888885, 0.9037640690803528, -0.35641011595726013, 0.265174925327301, 0.029450787231326103, 0.33815237879753113, -0.6301215887069702, -0.12893445789813995, -0.14928482472896576, -0.7466182708740234, 0.8214249610900879, -0.3418785333633423, 0.3139412403106689...
$r_description = stripslashes($r_description); } $r_url = $row['url']; $r_username = $row['username']; $r_points = $row['points'];
[ -0.15814852714538574, 0.1509556621313095, 0.6283625364303589, -0.483654648065567, 0.05722550302743912, 0.20589858293533325, 0.22548972070217133, -0.419310599565506, -0.2470603734254837, -0.2859707772731781, -0.6662762761116028, 0.5808619260787964, -0.4349275827407837, 0.3869420289993286, ...
$r_ranking = $row['ranking']; $article = new Article($r_title, $r_description , $r_url, $r_username, $r_created, $r_modified); $article->id = $r_id; $article->points = $r_points; $article->ranking = $r_ranking;
[ -0.6270620226860046, 0.3216019570827484, 0.8131320476531982, -0.12931498885154724, -0.13071341812610626, -0.17388996481895447, 0.07528062164783478, -0.4356028735637665, -0.15346264839172363, -0.3731619417667389, -0.5156224370002747, 0.40401971340179443, -0.1795957237482071, 0.3564780950546...
$records[] = $article; } parent::closeConnection($db); } catch(Exception $e) { throw $e; } return $records; } ``` If anyone can help I would appreciate it. I'll do what David
[ 0.2491338551044464, 0.33304721117019653, 0.13416165113449097, -0.25162675976753235, 0.25029313564300537, -0.34479087591171265, 0.5370568633079529, -0.29266443848609924, 0.161004900932312, -0.33058106899261475, -0.25045856833457947, 0.4453141391277313, -0.31070008873939514, 0.41125118732452...
says, just that if you want the links ordered by the newest first then you have to add the "created" column in descending order: ``` $articles = Article::getAll("order by ranking desc, created DESC limit $offset, $num_items"); ```
[ 0.11835980415344238, 0.29972952604293823, 0.5871533155441284, 0.014133562333881855, -0.09208633750677109, -0.1860998272895813, -0.11273771524429321, -0.20324203372001648, -0.4086851477622986, -0.545969545841217, -0.38278332352638245, 0.4665120840072632, -0.3404064178466797, 0.2027443945407...
I am having an issue with Visual Studio 2008 SP1. Basically, I have a .NET 3.5 solution with a client, shared and server component. While coding, all components run on the same box, but in production the server component is a standalone (remoting) service running on a separate server. I would expect that a change to t...
[ 0.3761921525001526, 0.12413501739501953, 0.25564780831336975, -0.31907743215560913, -0.14472343027591705, -0.15832756459712982, 0.1545647531747818, -0.11088878661394119, -0.15828853845596313, -0.543340265750885, -0.15321558713912964, 0.6869490742683411, -0.47607889771461487, 0.144153833389...
on the client, requires the server component service to be stopped so that the solution can be rebuilt in its entirety. Does anyone know if there is a particular setting that controls this?? OK folks. The problem was more simple than I at first thought. On the PCs that this did not work as desired I had to turn on the ...
[ 0.15740267932415009, 0.18461179733276367, 0.1472679227590561, -0.06851374357938766, -0.0762663409113884, -0.062333185225725174, 0.46914753317832947, 0.18716834485530853, -0.3031306266784668, -0.8248634338378906, -0.1184462234377861, 1.029362440109253, -0.20789717137813568, 0.09034679830074...
I am confused with learning about WPF. I see ControlTemplate used to determine how each item in a listbox looks. Isn't that what the ItemTemplate is used for in listboxes? What is the difference? A ControlTemplate let's you change the look&feel of existing controls, for example, make a normal everyday button look like ...
[ 0.25258225202560425, -0.5367147922515869, 0.6426095962524414, 0.32752785086631775, 0.10443049669265747, -0.01010556984692812, -0.17858491837978363, -0.19153718650341034, -0.3582525849342346, -0.6313285827636719, 0.2591557204723358, 0.6363524198532104, -0.33658766746520996, 0.22414770722389...
can click on". You can replace the ListBox's control template to get something like a list box with rounded corners or custom scroll bars. A DataTemplate (ItemTemplate is a property of type DataTemplate) on the other hand let's you control how the data rows displayed inside list boxes (and other similar controls), da...
[ 0.02507333643734455, -0.18720601499080658, 0.4342278838157654, 0.49491408467292786, -0.17943190038204193, -0.1902444064617157, -0.12722599506378174, -0.15849646925926208, -0.2711283564567566, -0.7654458284378052, -0.15036317706108093, 0.2543436288833618, -0.05649702250957489, 0.22169883549...
used to change the internal layout of a list box - Charles Petzold's WPF book has an example of using it to make a normal list box display it's items in a circle.
[ 0.1835872083902359, -0.3154888153076172, -0.07441505044698715, 0.0005576818366535008, -0.04132897034287453, 0.2215309888124466, -0.11960108578205109, -0.26408231258392334, -0.5740194916725159, -0.43561843037605286, 0.001120407716371119, -0.17729945480823517, -0.5473905801773071, 0.43056017...
Here is my view source: ``` <input id="ctl00_cp_ctrlNew_lendeeMe" type="radio" name="ctl00$cp$ctrlNew$whoBorrowed" value="lendeeMe" /> ``` And I am trying to use this selector to check one of them, but it is not working: ``` $("input[@id$='lendeeMe']").attr('checked','checked'); ``` but if I do this, it works fin...
[ 0.09756886214017868, 0.08054187893867493, 0.7007777690887451, 0.005126269068568945, 0.16369272768497467, -0.10837920755147934, 0.03890093043446541, -0.26384231448173523, -0.04271357133984566, -0.49483728408813477, 0.1736651211977005, 0.959522545337677, -0.2010727971792221, 0.02420314215123...
the behavior and the ControlTemplate contains the look&feel - so a button is "something you click" not "a rectangle with some 3d effect you can click on". You can replace the ListBox's control template to get something like a list box with rounded corners or custom scroll bars. A DataTemplate (ItemTemplate is a prope...
[ -0.029187869280576706, -0.309069961309433, 0.532184898853302, 0.4811069071292877, -0.15915778279304504, -0.005056260619312525, -0.05895325914025307, -0.3551080822944641, -0.1620507538318634, -0.5891496539115906, 0.09140726923942566, 0.642472505569458, -0.30876848101615906, 0.11050605773925...
and the first name should be green if it starts with an A". And just for completeness there is also an ItemsPanelTemplate class that is used to change the internal layout of a list box - Charles Petzold's WPF book has an example of using it to make a normal list box display it's items in a circle.
[ -0.04167300462722778, -0.1630919873714447, -0.20162971317768097, 0.11063744127750397, -0.09377820789813995, -0.15799324214458466, -0.03925865516066551, -0.19290488958358765, -0.5765692591667175, -0.42379817366600037, -0.4638470411300659, -0.11337196081876755, -0.3008626699447632, 0.1321064...
I have a C# class library that contains methods that need to be used with an external application. Unfortunately this external application only supports external APIs in C/C++. Now I've managed to get a very simple COM example working between a C++ dll and a C# DLL, but I am stuck on how I can move around array data....
[ 0.5385069847106934, 0.12813569605350494, 0.08283908665180206, -0.3378804326057434, -0.04127384349703789, 0.22139732539653778, 0.09943024069070816, -0.39696282148361206, -0.09427054226398468, -0.8101300597190857, 0.27544087171554565, 0.6576999425888062, -0.28871357440948486, 0.2910098135471...
// Create the interface pointer. IUnitModelPtr pIUnit(__uuidof(UnitModel)); long lResult = 0; // Call the Add method. pIUnit->Add(5, 10, &lResult); *result = lResult; // Uninitialize COM. CoUninitialize(); } ``` This works fine to call the add method in my C# class. How can I modify t...
[ 0.3107556402683258, -0.16198083758354187, 0.5694643259048462, -0.32391536235809326, 0.09264650195837021, 0.3200284540653229, 0.2369910478591919, -0.41954341530799866, -0.09116043150424957, -0.5553048849105835, 0.3024013340473175, 0.8190879821777344, -0.6941940784454346, -0.1132199913263320...
and then pass it back the results to the array reference specified in the original function call (unmanaged) C++. I'll need to expose a function like this: --- \*calcin - reference to array of doubles \*calcOut - reference to array of doubles numIN - value of size of input array ``` DLL_EXPORT(void) doCalc(dou...
[ 0.07558304071426392, 0.00160284957382828, 0.4846407175064087, -0.21670369803905487, 0.11484894901514053, 0.09916570037603378, -0.0572308674454689, -0.2430296689271927, 0.02472323179244995, -0.5299975872039795, -0.063214972615242, 0.9365493655204773, -0.5479260683059692, -0.0411660224199295...
//into the array ref specified by the *calcOut reference } ``` --- I *think* I can use a C++\CLI DLL for the external application so if this is easier than straight COM then i'll be willing to look at that. Please be gentle as I am primarily a C# developer but have been thrown in the deep end of Interop and C++ ...
[ 0.34588855504989624, 0.15409007668495178, 0.16838152706623077, -0.25834399461746216, -0.2000497728586197, 0.10885124653577805, 0.2145097404718399, 0.24931909143924713, -0.053833555430173874, -0.5869700312614441, 0.25697848200798035, 0.8270664215087891, -0.27869918942451477, 0.0257730055600...
you're primarily a C# developer I hope you understand pointers because if you don't there's no way to be gentle. Passing arrays basically came down to using CoTaskMemAlloc family of functions on the C++ side (<http://msdn.microsoft.com/en-us/library/ms692727(VS.85).aspx>) and the Marshal class on the C# side (<http://...
[ 0.29449930787086487, 0.13808974623680115, 0.15742240846157074, 0.05850952863693237, 0.07031705975532532, -0.14353252947330475, 0.3244989514350891, -0.5786429643630981, -0.2445562332868576, -0.5843642950057983, -0.01873399131000042, 0.5419881343841553, -0.1953391134738922, -0.00374624948017...
unsafe public long bytesToCoTaskPtr( ref bytes thebytes, ref short byteCnt) { byteCnt = (short)thebytes.theArray.Length; IntPtr tmpptr = new IntPtr(); tmpptr = Marshal.AllocCoTaskMem(byteCnt); Marshal.Copy(thebytes.theArray, 0, tmpptr, byteCnt); return (long)tmpptr.ToPointer(...
[ 0.41099813580513, 0.19380033016204834, 0.1178625226020813, 0.13611891865730286, 0.38134297728538513, -0.06161365658044815, 0.8720813393592834, -0.44763457775115967, -0.13781732320785522, -0.17848651111125946, -0.017800357192754745, 0.6330499649047852, -0.4415758550167084, 0.442240804433822...
public string coTaskPtrToString(long theptr) { return Marshal.PtrToStringAnsi(new IntPtr(theptr)); } public byte[] coTaskPtrToBytes(long theptr, short thelen) { byte[] tmpbytes = new byte[thelen]; Marshal.Copy(new IntPtr(theptr), tmpbytes, 0, thelen); return tmpbytes; ...
[ 0.31107261776924133, 0.11118736118078232, 0.26919010281562805, 0.10987992584705353, -0.10468596965074539, 0.017156710848212242, 0.15890111029148102, -0.4570082128047943, -0.2108691781759262, -0.4810907244682312, -0.39943256974220276, 0.5425485372543335, -0.3072344660758972, 0.2227495312690...
(hRes == S_OK) { long size = 5; LPVOID ptr = CoTaskMemAlloc( size ); if( ptr != NULL ) { memcpy( ptr, "12345", size ); short ans = 0; pCalc->changeBytes( (__int64*)&ptr, &size, &ans ); CoTaskMemFree(ptr); } } CoUninitialize (); //DeInitialize all COM Components re...
[ 0.11091429740190506, -0.4297615885734558, 0.5902357697486877, -0.2563374638557434, 0.3255958557128906, 0.2746348977088928, 0.13493648171424866, -0.45803555846214294, -0.11749721318483353, -0.5108535289764404, -0.4806182384490967, 0.6986817121505737, -0.33463409543037415, 0.2293676882982254...
{ try { IntPtr interopPtr = new IntPtr(ptr); testservice.ByteArray bytes = new testservice.ByteArray(); byte[] somebytes = new byte[arraysize]; Marshal.Copy(interopPtr, somebytes, 0, arraysize);
[ 0.3582075834274292, -0.04457758739590645, 0.18757013976573944, 0.053000558167696, 0.29173916578292847, 0.16965270042419434, 0.36196422576904297, -0.5713629722595215, -0.16105696558952332, -0.48021379113197327, -0.3960758447647095, 0.3249899744987488, -0.34099313616752625, 0.245382517576217...
bytes.theArray = somebytes; CalculatorClient client = generateClient(); client.takeArray(ref bytes); client.Close(); if (arraysize < bytes.theArray.Length) { interopPtr = Marshal.ReAllocCoTaskMem(interopPtr, bytes.theArray.Length);//TODO :
[ -0.12282264232635498, -0.25086721777915955, 0.5966996550559998, -0.029736310243606567, 0.3495817482471466, 0.049314115196466446, 0.24203276634216309, -0.53822261095047, -0.3485894501209259, -0.3113565146923065, -0.19552230834960938, 0.5723708868026733, -0.2833455204963684, 0.08009801059961...
throws an exception if fails... deal with it } Marshal.Copy(bytes.theArray, 0, interopPtr, bytes.theArray.Length); ptr = interopPtr.ToInt64(); arraysize = bytes.theArray.Length; //TODO : do we need to free IntPtr? check all code for memory leaks... check for...
[ 0.18500418961048126, 0.0705045610666275, 0.06933166831731796, 0.11320865154266357, 0.3135177195072174, -0.21374788880348206, 0.40501633286476135, -0.6367817521095276, -0.4184974133968353, -0.41135039925575256, -0.23541873693466187, 0.3256113529205322, -0.36249881982803345, 0.09649046510457...
catch(Exception e) { return 3; } return 2; } ``` Sorry, but I don't have the time to work all this out and explain it properly, hopefully this will give you pointers in the right direction, at the very least some things to google. Good Luck PS : I got all the info to write th...
[ 0.33087286353111267, 0.16639010608196259, 0.3599163889884949, 0.0005658753216266632, 0.23520463705062866, -0.5315028429031372, 0.4264090359210968, 0.13082997500896454, 0.024136874824762344, -0.5886694192886353, 0.04098018258810043, 0.40940168499946594, -0.2842289209365845, -0.0794344767928...
it is out there.
[ 0.5112619996070862, 0.26235806941986084, 0.013549048453569412, -0.32255396246910095, 0.22560738027095795, -0.4438890814781189, 0.5917536616325378, 0.4144502282142639, -0.503642737865448, -0.4229191243648529, 0.03351198881864548, -0.025651507079601288, -0.3416571021080017, 0.399531334638595...
In an application I wrote a few years back I use function SystemParametersInfo with SPI\_GETPOWEROFFTIMEOUT to get the timeout for monitor off. On Vista this doesn't work anymore. So I decided to make this work on Vista, but after a few hours I feel like I'm no closer to a solution. Most of the functions I am going t...
[ 0.32633593678474426, -0.5608550906181335, 0.7325400114059448, 0.0606725737452507, -0.08011788874864578, -0.13537514209747314, 0.16398370265960693, -0.4794645309448242, -0.11565100401639938, -0.8054356575012207, 0.13438007235527039, 0.8329035639762878, -0.17651265859603882, -0.2104425132274...
this is the correct way, there is one thing I don't understand. On my system PowerEnumerate returns 3 keys. How do I know which one is for Monitor timeout? Here is my code so far. I'm having trouble with PowerReadACValue, I probably didn't define or use it properly. ``` class Program { [DllImport("powrprof.dll")]...
[ -0.04171684756875038, -0.4093726575374603, 1.0716155767440796, -0.14289423823356628, 0.19186250865459442, 0.07303714007139206, 0.5392584800720215, -0.39773812890052795, -0.041326820850372314, -0.6435222029685974, -0.07661981135606766, 1.0339564085006714, -0.32820767164230347, -0.0465311706...
IntPtr SchemeGuid, Guid SubGroupOfPowerSettingGuid, UInt32 AcessFlags, UInt32 Index, ref Guid Buffer, ref UInt32 BufferSize); [DllImport("powrprof.dll")]
[ -0.24247032403945923, -0.4853733777999878, 0.6371156573295593, -0.2598635256290436, -0.06884737312793732, 0.23167330026626587, 0.11273209005594254, -0.2905002534389496, -0.2638281285762787, -0.5541540384292603, -0.2019108235836029, 0.44984591007232666, -0.3928755819797516, -0.0987738668918...
static extern uint PowerReadACValue( IntPtr RootPowerKey, IntPtr SchemeGuid, IntPtr SubGroupOfPowerSettingGuid, Guid PowerSettingGuid, ref IntPtr Type,
[ -0.2848605215549469, -0.5208849310874939, 0.6274225115776062, 0.12879541516304016, -0.002702699275687337, 0.13313540816307068, 0.40760859847068787, -0.24300740659236908, -0.01589040271937847, -0.4117046892642975, -0.3025258779525757, 0.3267500698566437, -0.5134616494178772, -0.067557893693...
ref IntPtr Buffer, ref UInt32 BufferSize); static void Main(string[] args) { IntPtr activeGuidPtr = IntPtr.Zero; uint res = PowerGetActiveScheme(IntPtr.Zero, ref activeGuidPtr); if (res == 0) { Guid VideoSettingGuid = new Guid();
[ -0.021777842193841934, -0.49803459644317627, 0.9632685780525208, -0.25260668992996216, 0.10463866591453552, 0.2002844512462616, 0.36246031522750854, -0.31524577736854553, -0.08956510573625565, -0.2763903737068176, -0.36915323138237, 0.8338306546211243, -0.46540066599845886, 0.2182396203279...
UInt32 index = 0; UInt32 BufferSize = (UInt32)Marshal.SizeOf(typeof(Guid)); while (0 == PowerEnumerate( IntPtr.Zero, activeGuidPtr, new Guid("7516b95f-f776-4464-8c53-06167f40cc99"), 18, index, ref VideoSettingGuid, ref BufferSize)) { Console.Write(Vide...
[ -0.5086358189582825, -0.0031213744077831507, 0.7438497543334961, -0.1761460155248642, 0.3536635637283325, 0.05760815739631653, 0.2646486759185791, -0.4471285045146942, 0.05666861683130264, -0.47738218307495117, -0.24131730198860168, 0.6912066340446472, -0.20705537497997284, 0.0555341541767...
UInt32 size = 1024; IntPtr temp = Marshal.AllocHGlobal(1024); IntPtr type = IntPtr.Zero; PowerReadACValue(IntPtr.Zero, activeGuidPtr, IntPtr.Zero, VideoSettingGuid, ref type, ref temp, ref size); Console.Write(Marshal.PtrToStringUni(temp));
[ -0.31890907883644104, -0.07463713735342026, 0.4692325294017792, 0.16298829019069672, 0.047044139355421066, 0.14278966188430786, 0.5433456897735596, -0.5423458218574524, -0.057775259017944336, -0.4041215181350708, -0.25089317560195923, 0.5237997770309448, -0.2908746600151062, -0.08635029196...
Marshal.FreeHGlobal(temp); index++; } } } } ``` I also tried using GetActivePwrScheme and then ReadPwrScheme, but it doesn't seem to work either. GetActivePwrScheme always returns 0, even if I switch power schemes. I also tried running ReadPwrScheme with incremental values (1,2...
[ 0.22910365462303162, 0.0030248877592384815, 0.6383012533187866, 0.16845259070396423, 0.0851777121424675, -0.31156960129737854, 0.6536938548088074, -0.5352784991264343, -0.1027495488524437, -0.5946237444877625, 0.06981182098388672, 0.740841805934906, -0.28149697184562683, 0.1030049696564674...
the value I set for monitor timeout in control panel. I hope I have this totally wrong and there is a much easier way of doing this. I finally did have some luck and found a function which works on both XP and Vista - GetCurrentPowerPolicies. It is very simple to call and returns a lot of the current settings includin...
[ 0.16843676567077637, -0.47174811363220215, 0.808800995349884, 0.34891319274902344, 0.1486673355102539, -0.27846354246139526, 0.2991885840892792, 0.09304563701152802, -0.12036286294460297, -0.7094523310661316, 0.1453939825296402, 1.148900032043457, 0.01028549112379551, 0.11303837597370148, ...
I'm looking for a simple Java in-memory cache that has good concurrency (so LinkedHashMap isn't good enough), and which can be serialized to disk periodically. One feature I need, but which has proved hard to find, is a way to "peek" at an object. By this I mean retrieve an object from the cache without causing the ca...
[ 0.22562028467655182, 0.0388568714261055, 0.11590208113193512, 0.14543232321739197, 0.03564558923244476, -0.37997642159461975, 0.3622061014175415, 0.1741914302110672, -0.27125465869903564, -0.8703784346580505, 0.04039355367422104, 0.5114142894744873, -0.018103638663887978, 0.005486147478222...
was originally asked, [Google's Guava library](https://github.com/google/guava/wiki/CachesExplained) now includes a powerful and flexible cache. I would recommend using this.
[ 0.21031342446804047, 0.40072712302207947, -0.0811934620141983, 0.14042775332927704, 0.18502795696258545, -0.07916337251663208, -0.2734066843986511, 0.24543914198875427, -0.12714695930480957, -0.12352488934993744, 0.1364363431930542, 0.06577553600072861, -0.06145909056067467, 0.257139980792...
To teach myself Javascript, I'm trying to make a web page that gives users a list of items (e.g. foods), asks them to sort these foods from favorite to least favorite, and submit the data when they're done. Using jQuery sortables seems like a good way to do this. However, I'm not sure how the data submission should hap...
[ 0.46350929141044617, 0.0639040544629097, -0.04039647802710533, -0.03987323120236397, -0.16989369690418243, 0.11778150498867035, -0.24276170134544373, -0.09478984773159027, -0.056251320987939835, -0.9356147646903992, -0.1076982319355011, 0.23113895952701569, -0.2148292362689972, -0.05215246...
want the order of these items to be determined, and for this ordering to be sent back to the server (by the way, I'm using Django on the server side). It seems I can determine the order of the items with a function like this: ``` function getOrder() { var foods = $(".foods"); var ids = []; for(var x=0; x<...
[ 0.5141766667366028, 0.0873221904039383, 0.22870686650276184, -0.2552754282951355, 0.07119069248437881, 0.3095250427722931, -0.005485051311552525, -0.2530372142791748, -0.266353040933609, -0.6568037271499634, -0.028317436575889587, 0.48705947399139404, -0.1345679610967636, 0.247485831379890...
I call this function? I'm thinking it would be an onclick action when the user presses the submit button, but I'm not sure where the data the function returns would get passed. * What format would be the most appropriate for sending this ordering to the server (e.g JSON)? (I know this is a really basic question, but I...
[ 0.5040557384490967, -0.04684929549694061, 0.19837242364883423, -0.18104706704616547, -0.4456885755062103, 0.17973242700099945, -0.1425175666809082, -0.13420863449573517, -0.231985405087471, -0.6488360166549683, -0.129047691822052, 0.4366231858730316, -0.4151313304901123, 0.2231697291135788...
id='food_3'>Taco</li> </ul> <a href="javascript:saveFoods();">Save Order</a> ``` The following jQuery code would be appropiate: ``` function saveFoods(id) { var data = $("#foods").sortable('serialize'); var action = "/django/view/"; $.post(action, data, function(json, status) { if(status == 'succ...
[ 0.189158096909523, 0.061274755746126175, 0.2662354111671448, -0.33577001094818115, 0.14417116343975067, 0.26153039932250977, -0.031108196824789047, -0.19314081966876984, -0.20496168732643127, -0.4066857695579529, -0.29938650131225586, 0.521519660949707, -0.22703339159488678, 0.013296960853...
}, "json"); } ``` According to the jQuery docs on [sortable](http://docs.jquery.com/UI/Sortable), when you use serialize the elements of a sortable it requires their IDs to be in a `setname_number` format. So by having your list as `food_1`, `food_2`, etc. jQuery recognizes that the ID of Pizza is 1 and its set is fo...
[ 0.3340463638305664, 0.25354164838790894, -0.06304816901683807, -0.3463501036167145, 0.24188505113124847, 0.1278378814458847, -0.240604430437088, 0.1863616555929184, -0.13755159080028534, -0.7362961769104004, -0.4194762706756592, 0.3433001935482025, -0.32245510816574097, 0.1710093766450882,...
I need to insert new records into an Access database. I'm using Visual Studio 2008 and firstly create a asp.net website. I can connect to the information in Access databse using dataview or gridview and can query a particular entry (ie. Proposal No. -brings up all details linking to that proposal). I can then edi...
[ 0.1558731645345688, 0.31011831760406494, 0.29916054010391235, -0.005705322604626417, -0.13388000428676605, 0.052745215594768524, 0.05680828168988228, -0.2899535894393921, -0.20774653553962708, -0.8048827052116394, 0.2451295256614685, 0.36711207032203674, -0.023643024265766144, 0.3416298329...
the database. By using the gridview or dataview I am able to view all fields that exist in the table and edit them. Is there a way that I can get a blank gridview/dataview template (which includes all the fields in the table) and fill it out to then update the database? Thanks ``` >>> mydict = {'a':1,'b':3,'c':2} >>> s...
[ 0.3922167718410492, 0.20953774452209473, 0.5428903102874756, 0.11118537187576294, -0.1144259050488472, 0.08256372064352036, -0.04068272188305855, -0.06582651287317276, -0.1922646164894104, -0.8290101885795593, -0.0016917141620069742, 0.6261149048805237, -0.16064013540744781, 0.135475546121...
What is the difference between SELECT data from table directly or from view? And What is the best use for each one? According to Microsoft there is a performance benifit if you use **indexed** views in sql server 2000/2005/2008. Indexed views can increase query performance in the following ways 1. Aggregations c...
[ -0.09864403307437897, -0.15518443286418915, 0.6564381718635559, 0.29449188709259033, -0.5190026164054871, 0.04865291342139244, -0.1278150975704193, -0.2804524302482605, -0.5111951231956482, -0.4245758652687073, 0.2248726338148117, 0.4823715388774872, -0.2663041651248932, 0.1776680499315261...
overhead. So only add an index to a view if the benefit of its speed increase when running exceeds the time it takes to update the view's index. The below links give more information on this (on when to use what). 1. [SQL Server 2000/2005 Indexed View Performance Tuning and Optimization Tips](http://www.sql-server...
[ 0.11109168827533722, -0.1963266134262085, 0.4747929871082306, 0.14840711653232574, -0.4080582559108734, -0.0029235242400318384, -0.24575456976890564, -0.49034181237220764, -0.3042733669281006, -0.4594470262527466, 0.058212243020534515, 0.9833194613456726, -0.11546286940574646, -0.027650099...
The dropdown-menu (built by the select\_tag) in my application should call the filter-category-action as soon as the user changes the value in the dropdown-menu AND hits the 'Go' button. Now I'd like to get rid of the 'Go' button and have an observer (observe\_field?) call the filter-category-action as soon as the us...
[ 0.10613168030977249, -0.13813258707523346, 0.2825792729854584, -0.14241726696491241, -0.09967566281557083, -0.17407530546188354, 0.25039252638816833, -0.0028636055067181587, -0.2601567506790161, -0.5239576697349548, 0.09689861536026001, 0.7909325957298279, -0.600001871585846, -0.1743771731...
<% form_tag(filter_category_path(:id), :method => :post, :class => 'categories') do %> <label>Categories</label> <%= select_tag(:category, options_for_select(Category.all.map {|category| [category.name, category.id]}, @category_id)) %> <!-- i would like to get rid of this button --> <%= subm...
[ -0.16924826800823212, -0.20734494924545288, 0.5018112063407898, 0.06942806392908096, 0.041904352605342865, -0.15807025134563446, 0.02231057547032833, -0.3576470911502838, -0.19181932508945465, -0.8247784972190857, -0.3502615690231323, 0.5144934058189392, -0.34822148084640503, 0.09054151922...
<li> <%= link_to(_project.name, _project) %> </li> <% end %> </ul> <%= observe_category_select -%> ``` **HelperMethod** ``` def observe_category_select observe_field( :category, :url => filter_category_path(:id),
[ -0.07210252434015274, -0.2542250454425812, 0.3637607991695404, -0.16560925543308258, -0.1664315164089203, -0.14000071585178375, 0.130264014005661, -0.3187945783138275, -0.2688860595226288, -0.5987848043441772, -0.49397531151771545, 0.4297615885734558, -0.5999967455863953, -0.22572818398475...
:with => 'category', :on => 'change' ) end ``` **Javascript-Output of the HelperMethod** ``` <script type="text/javascript"> //<![CDATA[ new Form.Element.EventObserver('category', function(element, value) { new Ajax.Request('/categories/id/filter', {asynchronous:true, ...
[ -0.35930168628692627, -0.33417996764183044, 0.6711973547935486, 0.15230295062065125, -0.12885580956935883, -0.13948798179626465, -0.004723491612821817, -0.5949552655220032, -0.5263873338699341, -0.38857945799827576, -0.4852409362792969, 0.5256332159042358, -0.3753105103969574, -0.139904692...
@projects = @category.projects.find(:all) respond_to do |format| format.html # index.html.erb end end def index @projects = Category.find(params[:id]).projects.find(:all) respond_to do |format| format.html # index.html.erb end end def filter @category = Category.find(para...
[ -0.05030474439263344, 0.03836970403790474, 0.48929259181022644, -0.053370632231235504, -0.26351359486579895, 0.19343975186347961, 0.29998359084129333, -0.8040755987167358, -0.5798338055610657, -0.36680111289024353, -0.5439662337303162, 0.3035714328289032, -0.15727876126766205, -0.128577947...
'rake routes | grep filter'** ``` filter_category POST /categories/:id/filter {:controller=>"categories", :action=>"filter"} formatted_filter_category POST /categories/:id/filter.:format {:controller=>"categories", :action=>"filter"} ``` Your filter controller action ne...
[ 0.03106256015598774, -0.43653813004493713, 0.29778024554252625, 0.1303120106458664, -0.39912116527557373, -0.06798327714204788, 0.33614581823349, -0.7645045518875122, 0.006546233780682087, -0.5225812196731567, -0.00312146102078259, 0.34334421157836914, -0.28068071603775024, -0.088893719017...
end end ``` Or, if you want that action to respond in either context, put both in the block: ``` respond_to do |format| format.html # filter.html.erb format.js # filter.rjs end ``` This requires you to have a view file filter.rjs that will look something like: ``` page.replace_html :id_of_element_to_r...
[ -0.1820344775915146, -0.16255715489387512, 0.8558507561683655, -0.30356690287590027, -0.13618220388889313, -0.25581303238868713, 0.30677077174186707, -0.4639844298362732, -0.08122776448726654, -0.6038722991943359, -0.26327288150787354, 0.3580477237701416, -0.24534249305725098, -0.106784462...
I have another problem with my scripy now I have made it more advance, first off the count function doesnt work properly and it gives this error. *Warning: array\_push() [function.array-push]: First argument should be an array in C:\wamp\www\social\add.php on line 42* Here is my script: ``` $query = mysql_query("SEL...
[ -0.30182453989982605, -0.09282124787569046, 0.7277012467384338, -0.24990862607955933, 0.1632743775844574, 0.13979384303092957, 0.2521161437034607, -0.2771235704421997, -0.14591169357299805, -0.7152180075645447, -0.07491293549537659, 0.5015044808387756, -0.1969459503889084, 0.03633557632565...
array. Probably an empty string. So in option 2, you may want to do something like this before array\_push: ``` if (!is_array($friends2)) { $friends2 = array(); } ``` This way, if the person has no friends by this point (sad.. but you'll fix it by pushing a new friend to them), an empty friends list gets initializ...
[ -0.2537882924079895, -0.18998216092586517, 0.5014282464981079, -0.2797022759914398, 0.0016453268472105265, 0.04756421968340874, 0.23685573041439056, 0.04582323879003525, -0.3030872344970703, -0.8380535840988159, -0.08034311234951019, 0.4913657307624817, -0.3266080617904663, 0.1079663261771...
Why struct can not have parameterless constructor? What's the problem in doing this for CLR or why it's not allowed ? Please explain it as I don't understand it. I cannot have an explicit parameterless constructor, only the implicit one, that initializes all members to their default. > Although the CLR allows it, C# d...
[ -0.06724436581134796, 0.20858946442604065, 0.2774776816368103, -0.0002100113342748955, -0.31722575426101685, -0.2187889814376831, 0.22337374091148376, 0.07169003039598465, 0.00822747778147459, -0.31459012627601624, -0.08784021437168121, 0.4629981219768524, -0.5649353265762329, 0.0614654608...
a > default constructor, it will not be > called and that will only confuse you. > To avoid such problems, the C# > compiler disallows definition of a > default constructor by the user. And > because it doesn't generate a default > constructor, you can't initialize > fields when defining them, ...
[ -0.06573762744665146, 0.010994849726557732, 0.24056336283683777, -0.12635089457035065, -0.20438867807388306, -0.2675066590309143, 0.3162783980369568, 0.07189386337995529, 0.1205061674118042, -0.46403440833091736, -0.4271070063114166, 0.6323419809341431, -0.5780135989189148, -0.122236855328...
When I perform a simple query like this: ``` select * from nodeType ``` Calling `skip(N)` on the range iterator is slow. What am I doing wrong? Found out why (self answering) - was using document order by default. Try adding a sensible "order by" to the query - goes from minutes for 10000 nodes to < 1 second.
[ 0.15193358063697815, -0.12512266635894775, 0.36762410402297974, -0.09790340065956116, 0.0022516772150993347, -0.16811278462409973, 0.62567538022995, -0.36604398488998413, -0.23733928799629211, -0.41318362951278687, 0.11623820662498474, 0.3358917832374573, -0.08910345286130905, 0.0179169867...
I'm creating a network animator (similar to nam, if you have used it before). Basically, I have nodes represented as small dots on a GTK+ DrawingArea, and I update the positions of these nodes and redraw the DrawingArea in a loop. The resulting animation is fast, but not smooth (there's a lot of flicker). This is pro...
[ 0.17144158482551575, -0.07840068638324738, 0.40788301825523376, -0.11758599430322647, 0.038549523800611496, 0.1354852020740509, 0.053346239030361176, 0.04347895085811615, -0.29405635595321655, -1.0429620742797852, 0.22090154886245728, 0.500994861125946, -0.4275330603122711, 0.0510173887014...
= [n.position_at(self.t) for n in self.nodes] self.drawing_area.window.draw_rectangle(style.bg_gc[gtk.STATE_NORMAL], True, 0, 0, rect.width, rect.height) for p in pos: self.drawing_area.window.draw_arc(style.fg_gc[gtk.STATE_NORMAL], True, ...
[ -0.3630886673927307, -0.09489216655492783, 0.6172543168067932, -0.31602942943573, 0.14589610695838928, 0.6822010278701782, -0.08270514011383057, -0.3820907175540924, -0.3002995550632477, -0.38564854860305786, -0.1129307821393013, 0.24941734969615936, -0.13577474653720856, -0.08969739079475...
/ 2400.0) - NODE_SIZE/2, rect.height * (p.y / 2400.0) - NODE_SIZE/2, NODE_SIZE, NODE_SIZE,
[ 0.045906148850917816, -0.06722771376371384, 0.41223961114883423, 0.12395398318767548, -0.012221590615808964, 0.39576002955436707, 0.15466733276844025, 0.10543277859687805, -0.4413115978240967, -0.6506758332252502, -0.21585381031036377, 0.17600175738334656, 0.13479098677635193, 0.2288004606...
0, 64 * 360) ``` where `self.t` is the current time, which is incremented in the loop. I changed my code to render the frames onto a Pixmap, and replaced the DrawingArea with an Image. While this solved the flickering, now the CPU usage has peaked. The animation is still quite fast, but I don't think this method is ...
[ 0.31217336654663086, -0.11264262348413467, 0.6078206300735474, -0.020249726250767708, -0.18315346539020538, 0.09981150925159454, 0.26602107286453247, -0.10770237445831299, -0.24321338534355164, -0.6880810856819153, 0.1696585714817047, 0.5077058672904968, -0.3874146044254303, 0.039049897342...
is back to normal.
[ 0.2730330526828766, -0.060997746884822845, 0.3794393241405487, -0.24853521585464478, 0.387071430683136, -0.4781839847564697, 0.6037889122962952, 0.23458442091941833, -0.3112047016620636, -0.4705568850040436, -0.2877333462238312, -0.10849534720182419, 0.18619772791862488, 0.0783020630478859...
I'm getting unexpected results from the `round()` and `roundf()` functions in the `math.h` library. Here is the sample code: ``` #include <stdio.h> #include <math.h> int main(void) { float f; double d; /* Note man page says that roundf() returns a float and round() returns a double */ f = roun...
[ -0.06555609405040741, 0.129397451877594, 0.5181456208229065, -0.2845219373703003, 0.07217299938201904, 0.27371668815612793, 0.3709720969200134, -0.5214420557022095, -0.2333037108182907, -0.3381701111793518, -0.08180470764636993, 0.37949109077453613, -0.0570489801466465, 0.17361178994178772...
confirmed that the code works properly on a newer complier. (I think %lf is not the correct printf specifier but that doesn't affect the end result in this case.) I'll need to figure out why may compiler is behaving this way because I have running code that uses round() and has been compiler on the same machine. I'll u...
[ 0.06226583570241928, 0.39838072657585144, 0.38214951753616333, -0.1916685253381729, -0.0019547222182154655, -0.06191388517618179, 0.48676618933677673, -0.3348868787288666, -0.16498234868049622, -0.33071011304855347, -0.2079322189092636, 0.7796309590339661, -0.1826849728822708, -0.079868443...
(using `-fno-builtin`). Then it assumes that your round/roundf function is defined as ``` int round(); int roundf(); ``` Because in pre-C99 times there were no such functions yet, so it does not have a declaration and implicitly declares them then. And this will obviously fail, because the call-side treats the retu...
[ 0.042008232325315475, 0.25342321395874023, 0.4702528417110443, -0.5244046449661255, -0.13764925301074982, 0.00032698322320356965, 0.1454862356185913, -0.400064617395401, -0.2905750870704651, -0.12435515224933624, 0.06606532633304596, 0.550454318523407, -0.2936186194419861, 0.26766622066497...
is not even guaranteed to have anything to do with the float returned. The call-side reads from a place that it knows where integers are returned. But your compiler may return floats in another place (say, in a floating pointer register) from the callee side. The above could actually have done anything, including abort...
[ 0.4806075096130371, 0.21399322152137756, 0.29319360852241516, 0.23142997920513153, 0.10462411493062973, -0.4573932886123657, 0.3049890697002411, -0.15487860143184662, -0.3274107575416565, -0.13609635829925537, -0.14886771142482758, 0.37037819623947144, -0.20055215060710907, 0.2114348113536...
`man 3 round`. However, if you have a very old GCC - i'm not sure whether it supports enough of C99 to have that switch. Look into the feature test macros described in the manpage of round then.
[ -0.029684506356716156, 0.19757826626300812, 0.3127911388874054, -0.340246319770813, -0.26583483815193176, -0.06535494327545166, 0.26127564907073975, -0.35847359895706177, -0.24905869364738464, -0.36357367038726807, -0.016687601804733276, 0.7699111104011536, -0.3232017457485199, -0.07858849...
One of the features of [asynchronous programming](http://msdn.microsoft.com/en-us/library/ms228963(VS.85).aspx) in .NET is saving threads during long running operation execution. The `FileStream` class can be setup to allow asynchronous operations, that allows running (e.g.) a copy operation without virtually using any...
[ 0.22029301524162292, -0.21065229177474976, -0.11528920382261276, 0.26019883155822754, 0.11722148209810257, -0.24063172936439514, 0.08515692502260208, 0.004997288342565298, -0.3253018856048584, -0.7459962964057922, -0.02918093279004097, 0.3964952826499939, -0.2561071515083313, 0.26226404309...
operation in server environment if the asynchronous operation is times slower than the synchronous one? Actually, the conditions under which file i/o will be *actually* be asynchronous are rather specific, even at the native Win32 level. See [this article](http://www.lenholgate.com/archives/000765.html) for more detail...
[ 0.018537582829594612, -0.1517006903886795, 0.10476767271757126, 0.04221595078706741, 0.12796767055988312, -0.3461313843727112, 0.4484848082065582, 0.10609059780836105, -0.28607168793678284, -0.3884994387626648, -0.45379438996315, 0.5338055491447449, -0.20308370888233185, -0.076134800910949...
Is anyone aware of some work being done on generating RDF schema for a given RDF data instance ? It would be some thing like coming up with information like classes, their attributes, their associations(hierarchical or peer) with other classes and if possible data types of attributes. It all resembles RDF Schema. My o...
[ 0.6670762896537781, -0.04533316195011139, -0.216297909617424, 0.38233959674835205, -0.26432397961616516, -0.3136754631996155, 0.14046511054039001, 0.016936756670475006, -0.467436283826828, -0.6781579256057739, 0.23055866360664368, 0.3456915318965912, -0.3014219105243683, 0.1824054121971130...
like coming up with logical inferences (transitive relationships etc) from the class associations ? cheers > How do you choose between implementing a value object (the canonical example being an address) as an immutable object or a struct? I think your options are wrong. Immutable object and struct are not opposites,...
[ 0.07440885156393051, -0.13725894689559937, 0.07914256304502487, 0.2207513302564621, -0.2874654233455658, -0.10494042187929153, 0.2625456154346466, -0.15161852538585663, -0.12271401286125183, -0.5982270240783691, -0.05356530472636223, 0.6862677335739136, -0.4091096520423889, 0.0809359550476...
at all feasible. Structs should be reserved for small types that emulate value semantics, e.g. a custom `Date` type, a `Complex` number type similar entities. The emphasis here is on *small* since you don't want to copy large blobs of data, and indirection through references is actually cheap (so we don't gain much by ...
[ 0.32845762372016907, 0.09882182627916336, 0.2839219570159912, 0.21620358526706696, -0.07491019368171692, -0.4063049554824829, 0.25512680411338806, 0.1508169323205948, -0.20976285636425018, -0.6928501725196838, -0.35038042068481445, 0.5406414866447449, -0.330423504114151, -0.040047571063041...
I fear this is a really stupid question, but here goes: Why does the clear method in Java's default LinkedList implementation bother to walk the list and unhook all the nodes? Why not just unhook the header and leave the rest of the list connected -- the GC will get it anyway, no? Here's the method: ``` /** * Remov...
[ 0.013439337722957134, -0.03550180420279503, 0.39684608578681946, -0.04796389490365982, 0.26055821776390076, -0.5725481510162354, 0.3179129362106323, -0.11041152477264404, -0.11986146867275238, -0.34465646743774414, -0.4025766849517822, 0.31113380193710327, -0.6809847950935364, 0.3609714806...
e.next = e.previous = null; e.element = null; e = next; } header.next = header.previous = header; size = 0; modCount++; } ``` Why walk it? Why not just skip to `header.next = header.previous = header;`? Best I can figure is it helps the GC...? This link <http://java.sun.com/docs/books/per...
[ 0.05724411457777023, 0.20903365314006805, 0.4350733160972595, -0.08934827148914337, 0.015700813382864, -0.4065670967102051, 0.5048759579658508, -0.46029528975486755, -0.3714974820613861, -0.6609825491905212, -0.1805003583431244, 0.4161505103111267, -0.37037894129753113, -0.0653775334358215...
prevent the entire chain from being collected. Also, other operations in the list might be going on simultaneously (e.g. views through `subList()` or `Collections.unmodifiableList()`, iterators), and this ensures that those things perceive the list as "empty" immediately.
[ 0.24915306270122528, -0.18506786227226257, 0.007456216961145401, 0.11167045682668686, 0.24174764752388, -0.38138139247894287, 0.2513475716114044, -0.25474813580513, -0.6608858704566956, -0.2447163164615631, -0.6668017506599426, 0.6766390204429626, -0.2988351583480835, 0.19503770768642426, ...
Ok, i've been trying to solve this for about 2 hours now... Please advise: Tables: ``` PROFILE [id (int), name (varchar), ...] SKILL [id (int), id_profile (int), id_app (int), lvl (int), ...] APP [id (int), ...] ``` The lvl can basically go from 0 to 3. I'm trying to get this particular stat: "What is the p...
[ 0.41210436820983887, 0.21747207641601562, 0.7340127825737, -0.20324796438217163, 0.06284934282302856, 0.0712820366024971, 0.06690990179777145, -0.27138301730155945, -0.4836854338645935, -0.83482825756073, -0.1183716431260109, 0.785933256149292, -0.214983269572258, -0.309623658657074, 0.0...
(s.id_app = a.id AND s.lvl >= 2) GROUP BY a.id ) ``` More efficient way for `MySQL`: ``` SELECT AVG ( IFNULL ( ( SELECT 1 FROM skill s WHERE s.id_app = a.id
[ 0.0277649387717247, -0.013225185684859753, 0.4815080463886261, -0.1329023689031601, 0.09469108283519745, 0.15465715527534485, 0.23452363908290863, -0.5604203939437866, -0.1408298760652542, -0.45327189564704895, -0.3956679105758667, 0.7661532759666443, -0.06843533366918564, -0.2723121345043...
AND s.lvl >= 2 LIMIT 1, 1 ), 0 ) ) FROM app a ``` This will stop counting as soon as it finds the second skilled `person` for each `app`. Efficient if you have a few `app`'s but lots of `person`'s.
[ 0.028720518574118614, -0.1358402967453003, 0.6203465461730957, -0.04109308868646622, 0.06873426586389542, 0.21117344498634338, 0.39929598569869995, -0.4424256384372711, -0.2171200066804886, -0.7006675004959106, -0.2672249376773834, 0.6976467370986938, -0.17101413011550903, -0.4410852789878...
Here's a quick Perl question: How can I convert HTML special characters like `&uuml;` or `&#039;` to normal ASCII text? I started with something like this: ``` s/\&#(\d+);/chr($1)/eg; ``` and could write it for all HTML characters, but some function like this probably already exists? Note that I don't need a ful...
[ 0.24500086903572083, 0.12561170756816864, 0.43386682868003845, 0.016410397365689278, -0.20788176357746124, 0.2004847526550293, 0.10012508928775787, -0.11681976169347763, -0.2223132699728012, -0.34037017822265625, -0.16594727337360382, 0.4956360161304474, -0.414288192987442, -0.115766935050...
NSTimeInterval == double; (e.g. 169.12345666663) How can I round up this double so that there are only 2 digits left after the "dot"? It would be very good if the result is a NSNumber. If this is for display purposes, take a look at [NSNumberFormatter](http://developer.apple.com/documentation/Cocoa/Reference/Founda...
[ 0.3212851285934448, -0.06981408596038818, 0.34902653098106384, -0.27970486879348755, 0.052228961139917374, 0.0850648507475853, 0.36689043045043945, -0.31146466732025146, -0.4946683347225189, -0.5666515827178955, 0.17234528064727783, 0.3444872200489044, -0.2864334285259247, -0.0907520502805...
Okay I'm trying to rotate a Java Polygon based on it's original position of angle 0. x, and y end up being converted to an int at the end of me using them, so I could understand not seeing some change, but when the difference in angles is big like 0 to 180 I think I should see **something**. I've been at this for a l...
[ 0.4107683300971985, 0.2519712448120117, 0.32352113723754883, -0.3335651457309723, 0.15175357460975647, 0.06471354514360428, -0.04001175984740257, -0.14070254564285278, -0.279373437166214, -0.7630325555801392, 0.0391731932759285, 0.6761714816093445, -0.43794769048690796, -0.0388878211379051...
double dist = Math.sqrt(Math.pow(x - (o1.x + (o1.w/2)), 2) + Math.pow(y - (o1.y + (o1.h/2)),2)); x += (Math.sin(Math.toRadians(o1.a)) * dist); y -= (Math.cos(Math.toRadians(o1.a)) * dist); } ``` The values of `x` and `y` that are being manipulated in the `rotate` method will not be seen in the method that...
[ 0.16638581454753876, 0.023404089733958244, 0.48505932092666626, -0.3122248351573944, -0.04676739498972893, 0.12253334373235703, 0.618390679359436, -0.4127432703971863, 0.04661935940384865, -0.2880498170852661, -0.34118279814720154, 0.5476351380348206, -0.606027364730835, 0.0450428910553455...
method), the values of `x` and `y` will disappear. So currently, what is happening is: ``` x = 10; y = 10; o1 = new obj(); o1.a = 100; rotate(x, y, obj); System.out.println(x); // Still prints 10 System.out.println(y); // Still prints 10 ``` The only way to get multiple values back from a method in Java is to pas...
[ -0.3373068869113922, 0.008052718825638294, 0.6451382637023926, -0.20215186476707458, 0.12298396974802017, 0.13356608152389526, 0.23859208822250366, -0.40061140060424805, -0.27444174885749817, -0.3913382887840271, -0.09902722388505936, 0.3129221200942993, -0.35977935791015625, 0.20606242120...
return new Point(newX, newY); } public void callingMethod() { int x = 10; int y = 10; p = rotate(x, y, 45); System.out.println(x); // Should print something other than 10. System.out.println(y); // Should print something other than 10. } ``` That said, as [Pierre suggests](https://stackoverflow...
[ 0.10951594263315201, -0.17234301567077637, 0.6804559230804443, -0.16655339300632477, 0.01127723790705204, 0.21204155683517456, 0.011854114010930061, -0.5908107161521912, -0.2250005155801773, -0.5647507905960083, -0.278224915266037, 0.5596867799758911, -0.14946642518043518, 0.16474954783916...