<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" > <channel> <title>Muharrem Tığdemir</title> <atom:link href="/feed/" rel="self" type="application/rss+xml" /> <link></link> <description>Carpe Diem!!</description> <lastBuildDate>Sat, 05 Dec 2015 17:16:02 +0000</lastBuildDate> <language>en-US</language> <sy:updatePeriod> hourly </sy:updatePeriod> <sy:updateFrequency> 1 </sy:updateFrequency> <generator>https://wordpress.org/?v=6.2.2</generator> <site xmlns="com-wordpress:feed-additions:1">120145533</site> <item> <title>Mysql General Error 1364 Field Doesn’t Have Default Value</title> <link>/mysql-general-error-1364-field-doesnt-have-default-value/</link> <comments>/mysql-general-error-1364-field-doesnt-have-default-value/#comments</comments> <dc:creator><![CDATA[Muharrem Tığdemir]]></dc:creator> <pubDate>Sat, 05 Dec 2015 17:16:02 +0000</pubDate> <category><![CDATA[Laravel]]></category> <category><![CDATA[MySQL]]></category> <category><![CDATA[PHP]]></category> <category><![CDATA[error]]></category> <category><![CDATA[homestead]]></category> <category><![CDATA[laravel]]></category> <category><![CDATA[mysql]]></category> <guid isPermaLink="false">https://muharremtigdemir.com/?p=630</guid> <description><![CDATA[<p>Hi All, Since I’ve updated my homestead to 0.3.0 and mysql version is upgrade to 5.7.4. From that moment, my old projects has been started to throw problems which is Mysql General Error 1364 Field doesn’t have default value. Even migrations was not working, there has to be a problem. After my first research I’ve […]</p> <p>The post <a href="/mysql-general-error-1364-field-doesnt-have-default-value/">Mysql General Error 1364 Field Doesn’t Have Default Value</a> first appeared on <a href="">Muharrem Tığdemir</a>.</p>]]></description> <content:encoded><![CDATA[<p>Hi All,</p> <p>Since I’ve updated my homestead to 0.3.0 and <a href="http://3.125.49.171/category/mysql/">mysql</a> version is upgrade to 5.7.4. From that moment, my old projects has been started to throw problems which is <strong>Mysql General Error 1364 Field doesn’t have default value</strong>.</p> <p>Even migrations was not working, there has to be a problem. After my first research I’ve found a solution for Php <a href="http://3.125.49.171/category/laravel/">Laravel</a> Projects there is a “strict” parameter for mysql connection, when I set it true migrations worked well.. But, in some cases, I let the mysql to set default value such as integer fields are sets to ‘0’ and varchar fields are empty strings etc.. I need to use default values as before..</p> <p><span id="more-630"></span></p> <p>Finally, I solved my problem it’s all about <a href="http://dev.mysql.com/doc/refman/5.7/en/sql-mode.html#sql-mode-strict">SQL Mode Strict</a></p> <pre class="lang:mysql decode:true" title="Sql Mode">select @@sql_mode; </pre> <p>If the result includes <strong>STRICT_TRANS_TABLES</strong> parameters Mysql engine expect default parameters for field, otherwise you have to set that.</p> <p>Open terminal at the below command or find your my.ini/my.cnf file</p> <pre class="lang:sh decode:true">sudo nano /etc/mysql/my.cnf</pre> <p>Add at the below line after [mysqld]</p> <pre class="lang:mysql decode:true">sql-mode="NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"</pre> <p>Try again..</p> <p>Muharrem Tığdemir</p><p>The post <a href="/mysql-general-error-1364-field-doesnt-have-default-value/">Mysql General Error 1364 Field Doesn’t Have Default Value</a> first appeared on <a href="">Muharrem Tığdemir</a>.</p>]]></content:encoded> <wfw:commentRss>/mysql-general-error-1364-field-doesnt-have-default-value/feed/</wfw:commentRss> <slash:comments>1</slash:comments> <post-id xmlns="com-wordpress:feed-additions:1">630</post-id> </item> <item> <title>Bitbucket Repository with Composer</title> <link>/bitbucket-repository-with-composer/</link> <comments>/bitbucket-repository-with-composer/#respond</comments> <dc:creator><![CDATA[Muharrem Tığdemir]]></dc:creator> <pubDate>Fri, 21 Aug 2015 06:43:16 +0000</pubDate> <category><![CDATA[PHP]]></category> <category><![CDATA[Version Control]]></category> <category><![CDATA[bitbucket]]></category> <category><![CDATA[composer]]></category> <category><![CDATA[git]]></category> <guid isPermaLink="false">https://muharremtigdemir.com/?p=616</guid> <description><![CDATA[<p>Hi all, In this article , you will find a tutorial about , how to use github or bitbucket repositories with composer. Create Your Repository Most important thing in this step, we will use the repository name in composer.json. I used “blog/tutorial” as a package name. I prefer to use bitbucket and at the below code […]</p> <p>The post <a href="/bitbucket-repository-with-composer/">Bitbucket Repository with Composer</a> first appeared on <a href="">Muharrem Tığdemir</a>.</p>]]></description> <content:encoded><![CDATA[<p>Hi all,</p> <p>In this article , you will find a tutorial about , <strong><span style="text-decoration: underline;">how to use github or bitbucket repositories with composer</span></strong>.</p> <h3>Create Your Repository</h3> <p>Most important thing in this step, we will use the repository name in composer.json. I used “blog/tutorial” as a package name. I prefer to use bitbucket and at the below code copied from bitbucket repository page, following commands will init git repository to your local folder.</p> <pre class="lang:default decode:true">mkdir /path/to/your/project cd /path/to/your/project git init git remote add origin git@bitbucket.org:yourname/blog-tutorial.git</pre> <h3>Create Composer.json</h3> <p>Now, i defined a composer properties like , package name , description , authors , requirements etc.. For more information about composer.json please check <a href="https://getcomposer.org/doc/01-basic-usage.md#package-names">Composer Basic Usage</a></p> <p><strong>Note:</strong> When you finished to edit “composer.json” , dont forget to run</p> <pre class="lang:default decode:true">composer validate</pre> <pre class="lang:default decode:true">{ "name": "mtigdemir/blog-tutorial", "description": "Muharrem Tigdemir Blog Tutorial Package", "authors": [ { "name": "Muharrem Tığdemir", "email": "muharrem.tigdemir@gmail.com" } ], "require": { "php": ">=5.4", }, "require-dev": { "phpunit/phpunit": "~4.6" }, "autoload": { "psr-4": { "Mtigdemir\\Blog\\": "src/" } } }</pre> <p>As you can see, I’ve defined autoload psr-4 property with namespace “Mtigdemir\\Blog\\”</p> <p><span style="text-decoration: underline;"><strong>!IMPORTANT!</strong></span> <a href="http://www.php-fig.org/psr/psr-0/">PSR-0 is deprecated</a> , and PSR-4 standarts show us where to place files that will be autoloaded according to the specification. For more information about PSR-4 please check <a href="http://www.php-fig.org/psr/psr-4/">PHP Framework Interop Group</a></p> <pre class="lang:php mark:3 decode:true " title="User.php Class with namespace "><?php namespace Mtigdemir\Blog; // File must be under src directory class User { private $username; private $email; public function __constructor($username , $email){ $this->username = $username; $this->email = $email; } public function getEmail(){ return $this->email; } public function getUsername(){ return $this->username; } }</pre> <p>Let’s create a <em>User.class in src/</em> directory with <span style="text-decoration: underline;"><strong>Mtigdemir\Blog</strong></span> namespace. Your package is ready to use with User class lets push it !</p> <h3>It’s time to include our package into the project</h3> <p>First of all, we have to include our repository to new project at the below composer.json definition is my new project and I included “git@bitbucket.org:mtigdemir/blog-tutorial.git” to my repositories.</p> <p><strong><em>Note : if you are using private repository. You have add your ssh-key to bitbucket!</em></strong></p> <pre class="lang:default decode:true" title="Project composer.json">{ "name" : "mtigdemir/blog-tutorial-project", "description" : "Blog Tutorial Project", "repositories": [ { "type": "vcs", "url": "git@bitbucket.org:mtigdemir/blog-tutorial.git" } ], "require": { "php": ">=5.4", } } </pre> <pre class="lang:default decode:true">composer search mtigdemir</pre> <p>This composer command will find “mtigdemir” packages including my private repository , as a result composer will find our package name and description if everything is cool you will see this kind of result in command line about your package definition:<strong><em> “mtigdemir/blog-tutorial Blog tutorial Package”</em></strong></p> <pre class="lang:default decode:true">composer info mtigdemir/blog-tutorial</pre> <p>What about version ! I didn’t release any version , in that case if you pushed develop or master branch your requirement version will change that’s why composer info is very useful. My package version is “dev-master”</p> <pre class="lang:default decode:true" title="My Package information">name : mtigdemir/blog-tutorial descrip. : Blog tutorial Package keywords : versions : dev-master type : library source : [git] git@bitbucket.org:mtigdemir/blog-tutorial.git f37affd9a2f1500a4ff956aa727304ce66af951b dist : [] names : mtigdemir/blog-tutorial autoload psr-4 Bumin\Psp\Account\ => src/ requires php >=5.4 requires (dev) phpunit/phpunit ~4.6 </pre> <p>Now , you can add your package like at the below or add package to composer.json and update it !</p> <pre class="lang:default decode:true">composer require mtigdemir/blog-tutorial:dev-master</pre> <h3>Finally, I’m able to use my class in project — Yea only User Class user.php :((</h3> <p>Your package will be under <strong><em>vendor/</em></strong> directory like other packages from packagist.org.</p> <pre class="lang:default decode:true"><?php require "vendor/autoload.php"; $user = new \Mtigdemir\Blog\User("muharrem" , "muharrem.tigdemir@gmail.com"); echo $user->getUserName().'__'.$user->getEmail(); </pre> <p>I’m able to use my User Class with namespace ,</p> <p>I want to thank to my team-mate Aykut Aras for share with me all about this know-how..</p> <p>Muharrem Tığdemir</p><p>The post <a href="/bitbucket-repository-with-composer/">Bitbucket Repository with Composer</a> first appeared on <a href="">Muharrem Tığdemir</a>.</p>]]></content:encoded> <wfw:commentRss>/bitbucket-repository-with-composer/feed/</wfw:commentRss> <slash:comments>0</slash:comments> <post-id xmlns="com-wordpress:feed-additions:1">616</post-id> </item> <item> <title>Laravel Eloquent Model Events</title> <link>/laravel-eloquent-model-events/</link> <comments>/laravel-eloquent-model-events/#respond</comments> <dc:creator><![CDATA[Muharrem Tığdemir]]></dc:creator> <pubDate>Sun, 01 Feb 2015 16:04:19 +0000</pubDate> <category><![CDATA[Laravel]]></category> <category><![CDATA[MySQL]]></category> <category><![CDATA[PHP]]></category> <category><![CDATA[eloquent model events]]></category> <category><![CDATA[eloquent model trigger]]></category> <category><![CDATA[laravel model events]]></category> <category><![CDATA[laravel model trigger]]></category> <guid isPermaLink="false">https://muharremtigdemir.com/?p=537</guid> <description><![CDATA[<p>Hi All , In this post , I’ll talk about Eloquent Model Events. Looks Like Database Trigger Isn’t it? When I read the documentation , I said “Mysql already doing this so..”. Personally, still I prefer to use Mysql Triggers for database operations. It’s more faster and guaranteed. But day by day NoSQL solutions or Hybrid database solutions […]</p> <p>The post <a href="/laravel-eloquent-model-events/">Laravel Eloquent Model Events</a> first appeared on <a href="">Muharrem Tığdemir</a>.</p>]]></description> <content:encoded><![CDATA[<p>Hi All ,</p> <p style="padding-left: 30px;">In this post , I’ll talk about <em>Eloquent Model Events</em>.</p> <h3>Looks Like Database Trigger Isn’t it?</h3> <p style="padding-left: 30px;">When I read the documentation , I said “Mysql already doing this so..”. Personally, still I prefer to use Mysql Triggers for database operations. It’s more faster and guaranteed. But day by day NoSQL solutions or Hybrid database solutions like using MongoDB and Mysql together becoming as a popular solutions. Also each NoSQL database is different, but MongoDB doesn’t support actually stored procedures or triggers. In that case , we need to handle this kind of situations.</p> <p style="padding-left: 30px;">If you are interested in MySQL-NoSQL Hybrid Solution with Laravel. You can check <a href="https://github.com/jenssegers/laravel-mongodb#mysql-relations" target="_blank">this </a>package by <a title="Jenssegers" href="https://github.com/jenssegers" target="_blank">Jessenger</a>.</p> <h3>For More</h3> <p style="padding-left: 30px;"><a title="Laravel" href="http://3.125.49.171/category/laravel/" target="_blank">Laravel </a>site has a simple usage example for <strong>Eloquent Model Events</strong> for “Validation”. In real projects , we have to validate every input , when model “updating” and “creating” its very important. So, Model Events is amazingly useful for this job. You can check the JeffreyWay Model Validation package from <a title="Laravel Model Validation" href="https://github.com/JeffreyWay/Laravel-Model-Validation" target="_blank">github</a>. This package supports model based validation rules.</p> <p style="padding-left: 30px;">Generaly, we need to delete photos , avatars , attachments from FTP too or Logging Model actions<strong>. </strong> We can add more usages examples depends on situation. Let’s see abilities of Model Events.</p> <p style="padding-left: 30px;"><span id="more-537"></span></p> <h3>Event Types</h3> <ul style="list-style-type: circle;"> <li><code>Creating<span style="font-size: 16px; line-height: 24px;"> </span></code></li> <li><code>Created</code></li> <li><code>Updating</code></li> <li><code>Updated</code></li> <li><code>Saving</code></li> <li><code>Saved</code></li> <li><code>Deleting<span style="font-size: 16px; line-height: 24px;"> </span></code></li> <li><code>Deleted<span style="font-size: 16px; line-height: 24px;"> </span></code></li> <li><code>Restoring</code></li> <li><code>Restored</code></li> </ul> <h3>“Talk is cheap Show me the code”..</h3> <p>Let’s make a little scenario. I have “Users” , “Photos” and “Comments” with following Relations.</p> <ul> <li style="padding-left: 30px;">User Has Many Photo</li> <li style="padding-left: 30px;">User Has Many Comment</li> <li style="padding-left: 30px;">Photo Has Many Comment</li> </ul> <p><strong>Example 1 : </strong> I want to delete file of Photo from FTP when Model Deleted.</p> <pre class="lang:php decode:true"> protected static function boot() { parent::boot(); static::deleted(function(Photo $photo) { // Get the Real Photo Path $filename = public_path('photos/'.$photo->url); if (File::exists($filename)) { File::delete($filename); } else { return false; } }); } </pre> <p> </p> <p><strong>Example 2 : </strong>Let’s say I need to Log all update actions or versioning from Comment Model.</p> <pre class="lang:php decode:true" title="Updated Model Logging">protected static function boot() { parent::boot(); static::updated(function(Comment $comment){ Log::info($comment->user_id." updated at ".$comment->updated_at); //local.INFO: 1 updated at time }); }</pre> <p><em>You can check the storage/laravel.log file.</em></p> <p> </p> <p><strong>Example 3 :</strong> I want to update Total Photo Comment when new Comment created.</p> <p><span style="color: #00ffff;"><span style="color: #000000;"><strong>NOT</strong><strong>E</strong></span><em><span style="color: #000000;"><strong> :</strong></span><span style="color: #ff0000;"> This can be do it by MySQL trigger.</span></em></span></p> <pre class="lang:php decode:true" title="Comment Boot"> protected static function boot() { parent::boot(); static::created(function(Comment $comment) { //Created Comment echo "Created Comment : " . $comment; //Total Comment Belongs To Photo $total_comment = Photo::find($comment->photo_id)->comments()->count(); //Print Total Photo echo "</br>Total Comment : " . $total_comment; //Update total Comment of Photo echo "<br> Update Status : " . Photo::where('id', $comment->photo_id) ->update(array('total_comment' => $total_comment)); }); }</pre> <p> </p> <p>Most useful things in this example Depency Injection. When I call the static::created function. It’s comming with Created “Comment Model”. Now, i’m able to reach functions which is belongs to Comment Model like “photos()”</p> <p>As a Result Following SQL executed.</p> <pre class="lang:mysql decode:true">insert into `comments` (`text`, `user_id`, `photo_id`, `updated_at`, `created_at`) values ('Test Comment', '1', '9', '2015-02-01 11:32:12', '2015-02-01 11:32:12') select count(*) as aggregate from `comments` where `comments`.`photo_id` = '9' update `photos` set `total_comment` = '26', `updated_at` = '2015-02-01 11:32:12' where `id` = '9'</pre> <p> </p> <p>Happy Coding..</p> <p>Muharrem Tığdemir</p> <p> </p><p>The post <a href="/laravel-eloquent-model-events/">Laravel Eloquent Model Events</a> first appeared on <a href="">Muharrem Tığdemir</a>.</p>]]></content:encoded> <wfw:commentRss>/laravel-eloquent-model-events/feed/</wfw:commentRss> <slash:comments>0</slash:comments> <post-id xmlns="com-wordpress:feed-additions:1">537</post-id> </item> <item> <title>PDFlib – TET PHP Install and Example</title> <link>/pdflib-tet-php-install-and-example/</link> <comments>/pdflib-tet-php-install-and-example/#respond</comments> <dc:creator><![CDATA[Muharrem Tığdemir]]></dc:creator> <pubDate>Thu, 09 Oct 2014 20:44:00 +0000</pubDate> <category><![CDATA[PHP]]></category> <category><![CDATA[pdflib]]></category> <category><![CDATA[tet]]></category> <guid isPermaLink="false">https://muharremtigdemir.com/?p=505</guid> <description><![CDATA[<p>INSTALL PDFLib I have Xampp Server on Windows your paths can be change depends on your server application. Let’s download Latest Pdflib from this url. If you are using Linux , OS X , Oracle , IBM etc.. visit the page and download latest. Extract files.. You’ll see under this path ‘/bind/php/’ php-530_VS9 , php-540_VS9 , php-550_VS11 […]</p> <p>The post <a href="/pdflib-tet-php-install-and-example/">PDFlib – TET PHP Install and Example</a> first appeared on <a href="">Muharrem Tığdemir</a>.</p>]]></description> <content:encoded><![CDATA[<h2>INSTALL PDFLib</h2> <p>I have Xampp Server on Windows your paths can be change depends on your server application.</p> <p>Let’s download Latest Pdflib from <a title="Latest Library" href="http://www.pdflib.com/download/pdflib-family/pdflib-9/">this url</a>.</p> <ul> <li>If you are using Linux , OS X , Oracle , IBM etc.. visit the page and download latest.</li> <li>Extract files..</li> <li>You’ll see under this path ‘/bind/php/’ php-530_VS9 , php-540_VS9 , php-550_VS11 Pdflib support 5.3+</li> <li>Select the correct php version library with your own. If you dont know</li> </ul> <pre class="lang:default decode:true"><?php echo phpinfo(); ?> </pre> <ul> <li> Copy php_pdlib.dll to under your “php/ext”</li> <li> Open your php.ini your file and add “extension=php_pdlib.dll”</li> <li>Restart your Apache and try phpinfo again..</li> <li>You’ll see picture at the below</li> </ul> <figure id="attachment_507" aria-describedby="caption-attachment-507" style="width: 300px" class="wp-caption aligncenter"><a href="http://3.125.49.171/wp-content/uploads/2014/08/Image.jpg"><img data-attachment-id="507" data-permalink="/pdflib-tet-php-install-and-example/image-2/" data-orig-file="/wp-content/uploads/2014/08/Image.jpg" data-orig-size="662,165" data-comments-opened="1" data-image-meta="{"aperture":"0","credit":"","camera":"","caption":"","created_timestamp":"0","copyright":"","focal_length":"0","iso":"0","shutter_speed":"0","title":""}" data-image-title="Pdflib" data-image-description="" data-image-caption="<p>Pdflib install info</p> " data-medium-file="/wp-content/uploads/2014/08/Image-300x74.jpg" data-large-file="/wp-content/uploads/2014/08/Image.jpg" decoding="async" class="wp-image-507 size-medium" src="http://3.125.49.171/wp-content/uploads/2014/08/Image-300x74.jpg" alt="Pdflib install info" width="300" height="74" srcset="/wp-content/uploads/2014/08/Image-300x74.jpg 300w, /wp-content/uploads/2014/08/Image.jpg 662w" sizes="(max-width: 300px) 100vw, 300px" /></a><figcaption id="caption-attachment-507" class="wp-caption-text">Pdflib Install Info</figcaption></figure> <p><a title="PdfLib" href="http://www.pdflib.com/fileadmin/pdflib/pdf/support/PDFlib-in-PHP-HowTo.pdf">You can read this tutorial from original web site..</a></p> <p>You’ll be able to add someting to exist’s pdf file draw images etc.. This is amazingly easy to use library..</p> <h2>What About TET ??</h2> <p>I’ve only used this library with Php but , this library supports all most everything <img src="https://s.w.org/images/core/emoji/14.0.0/72x72/1f600.png" alt="😀" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p> <h5><strong><a title="Download Tet" href="http://www.pdflib.com/download/tet/" target="_blank">Download Tet</a> from this url which OS are you using it.. </strong></h5> <p>This won’t be the similar with PdfLib because there is no example in TET.</p> <p>When you setup it. Check your User folder “C:\Users\PC\Documents\PDFlib\TET(Version)\bind\php”</p> <ul> <li>From Now you can follow the similar steps with installing PdfLib</li> <li>When you completed check your <em><strong>phpinfo()</strong> </em>you’ll see this extesnsion at the below</li> </ul> <figure id="attachment_506" aria-describedby="caption-attachment-506" style="width: 673px" class="wp-caption aligncenter"><a href="http://3.125.49.171/wp-content/uploads/2014/08/Imag2e.jpg"><img data-attachment-id="506" data-permalink="/pdflib-tet-php-install-and-example/imag2e/" data-orig-file="/wp-content/uploads/2014/08/Imag2e.jpg" data-orig-size="673,176" data-comments-opened="1" data-image-meta="{"aperture":"0","credit":"","camera":"","caption":"","created_timestamp":"0","copyright":"","focal_length":"0","iso":"0","shutter_speed":"0","title":""}" data-image-title="Tet Install Info" data-image-description="" data-image-caption="<p>Tet install </p> " data-medium-file="/wp-content/uploads/2014/08/Imag2e-300x78.jpg" data-large-file="/wp-content/uploads/2014/08/Imag2e.jpg" decoding="async" loading="lazy" class="wp-image-506 size-full" src="http://3.125.49.171/wp-content/uploads/2014/08/Imag2e.jpg" alt="Tet install " width="673" height="176" srcset="/wp-content/uploads/2014/08/Imag2e.jpg 673w, /wp-content/uploads/2014/08/Imag2e-300x78.jpg 300w" sizes="(max-width: 673px) 100vw, 673px" /></a><figcaption id="caption-attachment-506" class="wp-caption-text">Tet install Info</figcaption></figure> <pre class="lang:default decode:true "><?php $p = new PDFlib(); $tet = new TET(); ?></pre> <p> </p> <p> </p> <p> </p> <p>Muharrem Tığdemir</p><p>The post <a href="/pdflib-tet-php-install-and-example/">PDFlib – TET PHP Install and Example</a> first appeared on <a href="">Muharrem Tığdemir</a>.</p>]]></content:encoded> <wfw:commentRss>/pdflib-tet-php-install-and-example/feed/</wfw:commentRss> <slash:comments>0</slash:comments> <post-id xmlns="com-wordpress:feed-additions:1">505</post-id> </item> <item> <title>Google AppEngine Java Channel API Basic Example</title> <link>/google-appengine-java-channel-api-basic-example/</link> <comments>/google-appengine-java-channel-api-basic-example/#respond</comments> <dc:creator><![CDATA[Muharrem Tığdemir]]></dc:creator> <pubDate>Tue, 26 Aug 2014 11:18:26 +0000</pubDate> <category><![CDATA[Java]]></category> <category><![CDATA[channel api]]></category> <category><![CDATA[google app engine]]></category> <guid isPermaLink="false">https://muharremtigdemir.com/?p=510</guid> <description><![CDATA[<p>Hi all , Currently i’m working on Google App Engine with Channel API. I just needed basic socket example. I’ll show you how to create basic example. Steps.. Setup Eclipse Google App Engine Plugin Send Message From Servlet to Client Client Listener Deploy.. How to Install Google App Engine Eclipse Plugin Note : When you […]</p> <p>The post <a href="/google-appengine-java-channel-api-basic-example/">Google AppEngine Java Channel API Basic Example</a> first appeared on <a href="">Muharrem Tığdemir</a>.</p>]]></description> <content:encoded><![CDATA[<p>Hi all ,</p> <p style="padding-left: 30px;">Currently i’m working on Google App Engine with Channel API. I just needed basic socket example. I’ll show you how to create basic example.</p> <p style="padding-left: 30px;">Steps..</p> <ol> <li>Setup Eclipse Google App Engine Plugin</li> <li>Send Message From Servlet to Client</li> <li>Client Listener</li> <li>Deploy..</li> </ol> <p><span id="more-510"></span></p> <h4>How to Install Google App Engine Eclipse Plugin</h4> <p>Note : When you downloading Eclipse choose the EE version. Check your Eclipse version under the eclipse directory in “.eclipseproduct”. If your version is under 3.8 you’ll be able to install from local archive. <span style="text-decoration: underline;"><span style="text-decoration: underline;">Please Check the plugin that corresponds to your version of Eclipse.</span></span> I’m using Kepler 4.3: https://dl.google.com/eclipse/plugin/4.3</p> <ul> <li>Help->Install New Software add your location and install SDK. (I only need this for socket example)</li> <li>Restart Eclipse</li> <li>File->New->Web Application Project</li> <li>Done!!</li> </ul> <h4>Basic Java Servlet</h4> <p style="text-align: center;">Message Sender Servlet</p> <pre class="lang:java decode:true" data-url="TestServlet">package com.mtigdemir; import java.io.IOException; import javax.servlet.http.*; import com.google.appengine.api.channel.ChannelMessage; import com.google.appengine.api.channel.ChannelService; import com.google.appengine.api.channel.ChannelServiceFactory; @SuppressWarnings("serial") public class ServletTest extends HttpServlet { public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException { ChannelService channelService = ChannelServiceFactory.getChannelService(); channelService.sendMessage(new ChannelMessage("logger", "Connection Testing.. ")); } } </pre> <p style="text-align: center;"> web.xml</p> <pre class="lang:default decode:true " data-url="web.xml"><?xml version="1.0" encoding="utf-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5"> <servlet> <servlet-name>ServletTest</servlet-name> <servlet-class>com.bumin.ServletTest</servlet-class> </servlet> <servlet-mapping> <servlet-name>ServletTest</servlet-name> <url-pattern>/test</url-pattern> </servlet-mapping> <welcome-file-list> <welcome-file>Logger.jsp</welcome-file> </welcome-file-list> </web-app> </pre> <p> </p> <h4>Basic Client</h4> <p style="text-align: center;">Channel API Javascript Socket Listener</p> <pre class="lang:default decode:true" data-url="Logger Page"><%@ page contentType="text/html;charset=UTF-8" language="java" %> <%@ page import="java.util.List" %> <%@ page import="com.google.appengine.api.users.User" %> <%@ page import="com.google.appengine.api.users.UserService" %> <%@ page import="com.google.appengine.api.users.UserServiceFactory" %> <%@ page import="com.bumin.model.Todo" %> <%@ page import="com.bumin.dao.Dao" %> <%@ page import="com.google.appengine.api.channel.ChannelService" %> <%@ page import="com.google.appengine.api.channel.ChannelServiceFactory" %> <%@page import="java.util.ArrayList"%> <% ChannelService channelService = ChannelServiceFactory.getChannelService(); String token = channelService.createChannel("logger"); %> <!DOCTYPE html> <html> <head> <script src='//code.jquery.com/jquery-1.7.2.min.js'></script> <script src="/_ah/channel/jsapi"></script> </head> <body> <script> var token ="<%=token %>";// This will creaete unique identifier(some id created by google api + ur key) channel = new goog.appengine.Channel('<%=token%>'); socket = channel.open(); socket.onopen = function() {$('#messages').append('<p>Connected!</p>'); }; socket.onmessage = function(message) { console.log(message); console.log('message' + message); $('#messages').append('<p>' + message.data + '</p>'); }; socket.onerror = function() { $('#messages').append('<p>Connection Error!</p>'); }; socket.onclose = function() { $('#messages').append('<p>Connection Closed!</p>'); }; </script> LOG Messages <p id="messages"></p> </body> </html></pre> <p> </p> <h4>Sign In with your Google Account</h4> <p>Until you want to deploy your project to Google Server this step isn’t necesary. But live is better and also free until charge limits :))</p> <ul> <li>Before deploy your application check the 24 Hours <a title="Channel API Quata" href="https://developers.google.com/appengine/docs/quotas#Channel">App Engine Quotas</a> for Channel API</li> </ul> <p style="padding-left: 30px;">Daily Quata limits can be change day by day</p> <table width="75%"> <tbody> <tr> <th rowspan="2" width="30%">Resource</th> <th colspan="2" width="35%">Free Default Limit</th> <th colspan="2" width="35%">Billing Enabled Default Limit</th> </tr> <tr> <th width="17.5%">Daily Limit</th> <th width="17.5%">Maximum Rate</th> <th width="17.5%">Daily Limit</th> <th width="17.5%">Maximum Rate</th> </tr> <tr> <td width="30%">Channel API Calls</td> <td width="17.5%">657,000 calls</td> <td width="17.5%">3,000 calls/minute</td> <td width="17.5%">91,995,495 calls</td> <td width="17.5%">32,000 calls/minute</td> </tr> <tr> <td>Channels Created</td> <td>100 channels</td> <td>6 creations/minute</td> <td>Based on your budget</td> <td>60 creations/minute</td> </tr> <tr> <td>Channel Hours Requested</td> <td>200 hours</td> <td>12 hours requested/minute</td> <td>Based on your budget</td> <td>180 hours requested/minute</td> </tr> <tr> <td>Channel Data Sent</td> <td>Up to the Outgoing Bandwidth quota</td> <td>22 MB/minute</td> <td>1 TB</td> <td>740 MB/minute</td> </tr> </tbody> </table> <ul> <li>Right click your project Google-> Deploy to App Engine that’s it!!</li> </ul> <h4>Finally</h4> <p>Let’s run at local http://localhost:8888/Logger.jsp http://localhost:8888/test?message=mymessage open together.</p> <figure id="attachment_513" aria-describedby="caption-attachment-513" style="width: 1853px" class="wp-caption aligncenter"><a href="http://3.125.49.171/wp-content/uploads/2014/08/Adsız.jpg"><img data-attachment-id="513" data-permalink="/google-appengine-java-channel-api-basic-example/adsiz/" data-orig-file="/wp-content/uploads/2014/08/Ads%C4%B1z.jpg" data-orig-size="1853,443" data-comments-opened="1" data-image-meta="{"aperture":"0","credit":"","camera":"","caption":"","created_timestamp":"0","copyright":"","focal_length":"0","iso":"0","shutter_speed":"0","title":""}" data-image-title="Adsız" data-image-description="" data-image-caption="<p>Channel API Final</p> " data-medium-file="/wp-content/uploads/2014/08/Ads%C4%B1z-300x71.jpg" data-large-file="/wp-content/uploads/2014/08/Ads%C4%B1z-1024x244.jpg" decoding="async" loading="lazy" class="size-full wp-image-513" src="http://3.125.49.171/wp-content/uploads/2014/08/Adsız.jpg" alt="Channel API Final" width="1853" height="443" srcset="/wp-content/uploads/2014/08/Ads%C4%B1z.jpg 1853w, /wp-content/uploads/2014/08/Ads%C4%B1z-300x71.jpg 300w, /wp-content/uploads/2014/08/Ads%C4%B1z-1024x244.jpg 1024w" sizes="(max-width: 1853px) 100vw, 1853px" /></a><figcaption id="caption-attachment-513" class="wp-caption-text">Channel API Final</figcaption></figure> <p>You’ll see push notification when get the “/test” route. parameter is “message”There is my Live Application : <a href="http://1-dot-southern-branch-679.appspot.com/">http://1-dot-southern-branch-679.appspot.com/</a>Don’t Forget the open<a title="Logger" href="http://1-dot-southern-branch-679.appspot.com/Logger.jsp"> http://1-dot-southern-branch-679.appspot.com/Logger.jsp</a></p> <p>Muharrem Tığdemir</p><p>The post <a href="/google-appengine-java-channel-api-basic-example/">Google AppEngine Java Channel API Basic Example</a> first appeared on <a href="">Muharrem Tığdemir</a>.</p>]]></content:encoded> <wfw:commentRss>/google-appengine-java-channel-api-basic-example/feed/</wfw:commentRss> <slash:comments>0</slash:comments> <post-id xmlns="com-wordpress:feed-additions:1">510</post-id> </item> <item> <title>Laravel4 Queue with Gearman</title> <link>/laravel4-queue-gearman/</link> <comments>/laravel4-queue-gearman/#respond</comments> <dc:creator><![CDATA[Muharrem Tığdemir]]></dc:creator> <pubDate>Tue, 08 Jul 2014 12:29:16 +0000</pubDate> <category><![CDATA[Gearman]]></category> <category><![CDATA[PHP]]></category> <category><![CDATA[laravel]]></category> <category><![CDATA[laravel 4]]></category> <category><![CDATA[laravel gearman integration]]></category> <category><![CDATA[laravel queue]]></category> <category><![CDATA[queue]]></category> <guid isPermaLink="false">https://muharremtigdemir.com/?p=471</guid> <description><![CDATA[<p>Hi all , this article about Laravel4 Queue component. Before, start reading this article please check these pages and get basic knowledge about it. Laravel 4.2 Queue Documentation What’s main idea of Queue system and why do we need this? What is Gearman Job Server? If you are interested in Laravel 4 Queue component , […]</p> <p>The post <a href="/laravel4-queue-gearman/">Laravel4 Queue with Gearman</a> first appeared on <a href="">Muharrem Tığdemir</a>.</p>]]></description> <content:encoded><![CDATA[<p>Hi all , this article about Laravel4 Queue component.</p> <p>Before, start reading this article please check these pages and get basic knowledge about it.</p> <ol> <li><a title="Laravel 4 Queues" href="http://laravel.com/docs/queues">Laravel 4.2 Queue Documentation</a></li> <li><a href="http://www.grandlogic.com/content/html_docs/products-jobserver.shtml">What’s main idea of Queue system and why do we need this?</a></li> <li><a title="Gearman" href="http://gearman.org/">What is Gearman Job Server?</a></li> </ol> <p style="padding-left: 30px;">If you are interested in Laravel 4 Queue component , you’ll have good options for Job Server like;</p> <ul> <li><a title="Redis" href="http://redis.io/" target="_blank">Redis</a></li> <li><a title="AWS" href="http://aws.amazon.com/" target="_blank">Amazon</a></li> <li><a href="http://kr.github.io/beanstalkd/" target="_blank"><span style="color: #454545;">Beanstalkd</span></a></li> <li><a href="http://www.iron.io/mq" target="_blank"><span style="color: #454545;">IronMQ</span></a></li> </ul> <p>These are supported in Laravel Default Framework..</p> <h3>What should I pay attention while choosing Job Server Platform?</h3> <p><span id="more-471"></span></p> <ul> <li> Most important thing is your volume. How many job will handle with this server ?</li> <li> How much time is going to be completed for standart one task?</li> <li>Do you need cross-platform integration in your application ? Like Php based system and Java Based Compression Tool etc..</li> </ul> <p>If you have only hardware(not enough CPU , RAM) problems , I suggest you to buy a service from Amazon or IronMQ.</p> <p>or If you just need quickness and velocity for visitors. You’ve to deal with local solutions. Redis , IronMQ etc..</p> <p>As you know , Sometimes its not possible solve everyting with one language and you’d need Hybrid solutions. Then we are talking about Gearman <img src="https://s.w.org/images/core/emoji/14.0.0/72x72/1f600.png" alt="😀" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p> <p>Just select your language..</p> <h3>Gearman Support Famous Languages</h3> <p>Please <a title="Gearman Documentation" href="http://gearman.org/documentation/" target="_blank">check this site</a> for documentation and more indormation</p> <ul> <li>PHP</li> <li>Mysql</li> <li>Java</li> <li>Go</li> <li>C#</li> <li>Node.js</li> <li>…</li> </ul> <p>It’s not complicated to develop Hybrid Solutions with Gearman.</p> <h3>Setup Gearman into Server</h3> <ul> <li> <pre class="lang:default decode:true" title="Setup Gearman Ubuntu">apt-get install gearman-job-server gearmand -d</pre> <p>For other Operating Systems <a title="Gearman Install" href="http://gearman.org/getting-started/">check this page</a>.</li> </ul> <h3>Gearman Integration with Laravel Queue</h3> <p>This bundle is very easy to integrate Gearman with Laravel : <a href="https://github.com/pafelin/laravel-gearman">Github Link</a></p> <p>Thanks for useful github project.</p> <p>If you succesfully added Gearman bundle into your project , Now you can check queue list by laravel command line.</p> <ul> <li> <pre class="lang:default decode:true">php artisan queue:listen</pre> </li> </ul> <h3>Do not forget to Setup Gearman Monitoring UI</h3> <ul> <li> <pre style="color: #333333;"><code style="color: #333333;">git clone git://github.com/gaspaio/gearmanui.git gearman-ui</code></pre> </li> <li> <pre style="color: #333333;"><code style="color: #333333;">cd gearman-ui composer install</code></pre> </li> <li> <pre style="color: #333333;"><code style="color: #333333;"> cp app/config/gearmanui.yml.dist app/config/gearmanui.yml</code></pre> </li> </ul> <p><a title="Gearman UI" href="http://gaspaio.github.io/gearmanui/">Project</a> : This opensource project definetily monitoring basic info about Gearman Server. That’s exactly what I need. You can find more specific monitors if you need it.</p> <h3>What about Laravel Queue Trick</h3> <p>I love default routing for Fail or Exceptions. It’s very necesary in real-time actions.</p> <ul> <li> <pre class="lang:default decode:true">php artisan queue:failed-table php artisan migrate </pre> </li> </ul> <p>Let say you are using Local Solution as a Job Server and it Crashed. We’ve to handle this kind of situations. Laravel doing this for you just add the above part. Laravel save failed jobs into Mysql->’failed-table’ That’s it..</p> <ul> <li> <pre class="lang:default decode:true">Queue::failing(function($connection, $job, $data) { //OMG My Server Crashed or Something wrong send me an email right now!!! });</pre> <p>With this routing we’ll be able to in touch our Job Server.</li> </ul> <p>Muharrem Tığdemir</p><p>The post <a href="/laravel4-queue-gearman/">Laravel4 Queue with Gearman</a> first appeared on <a href="">Muharrem Tığdemir</a>.</p>]]></content:encoded> <wfw:commentRss>/laravel4-queue-gearman/feed/</wfw:commentRss> <slash:comments>0</slash:comments> <post-id xmlns="com-wordpress:feed-additions:1">471</post-id> </item> <item> <title>Laravel 4 Paylaşımlı Host Komut (Shared Host Command)</title> <link>/laravel-4-paylasimli-host-komut-shared-host-command/</link> <comments>/laravel-4-paylasimli-host-komut-shared-host-command/#respond</comments> <dc:creator><![CDATA[Muharrem Tığdemir]]></dc:creator> <pubDate>Tue, 15 Apr 2014 08:38:31 +0000</pubDate> <category><![CDATA[Laravel]]></category> <category><![CDATA[PHP]]></category> <category><![CDATA[cli]]></category> <category><![CDATA[command]]></category> <category><![CDATA[laravel]]></category> <guid isPermaLink="false">https://muharremtigdemir.com/?p=452</guid> <description><![CDATA[<p>Merhaba Arkadaşlar , Laravel projenizi henüz paylaşımlı host’a yüklemediyseniz. Laravel Paylaşımlı Host’ta yayınlamak. ile ilgili yazımı okuyabilirsiniz. Projemiz’i teknik olarak internete açtık. Ancak , şimdi içerikleri nasıl dolduracağız. Migration’ları seed’leri boşuna mı yazdık? ‘Hayat “http://localhost” da çok güzeldi.’ peki ya şimdi.. Bana göre Laravel’i üst seviyelere taşıyan ve önüzmüzdeki yıllarda daha popüler olmasını sağlayacak özellikleri : Composer […]</p> <p>The post <a href="/laravel-4-paylasimli-host-komut-shared-host-command/">Laravel 4 Paylaşımlı Host Komut (Shared Host Command)</a> first appeared on <a href="">Muharrem Tığdemir</a>.</p>]]></description> <content:encoded><![CDATA[<p>Merhaba Arkadaşlar ,</p> <p style="padding-left: 30px;">Laravel projenizi henüz paylaşımlı host’a yüklemediyseniz. <a title="Laravel 4 Paylaşımlı Host Yayın(Shared Host Publish)" href="http://3.125.49.171/laravel-4-paylasimli-host-yayinshared-host-publish/" target="_blank">Laravel Paylaşımlı Host’ta yayınlamak.</a> ile ilgili yazımı okuyabilirsiniz.</p> <p style="padding-left: 30px;">Projemiz’i teknik olarak internete açtık. Ancak , şimdi içerikleri nasıl dolduracağız. Migration’ları seed’leri boşuna mı yazdık? ‘Hayat “<strong>http://localhost</strong>” da çok güzeldi.’ peki ya şimdi..</p> <p style="padding-left: 30px;">Bana göre Laravel’i üst seviyelere taşıyan ve önüzmüzdeki yıllarda daha popüler olmasını sağlayacak özellikleri : Composer , Bundle , Eloquent , Migratin , Seed vs.. bunlar başta olmak üzere geliştirilen opensource kütüphaneleri entegre çalışması. Eloquent hariç tüm bu özellikler bildiğiniz üzere konsol bağlantısı gerektiriyor veya tutorial’dan öyle gördük.</p> <p style="padding-left: 30px;"> <h3 style="padding-left: 30px;">VPS’imiz , SSH’ımız yok ölelim mi?</h3> <p style="padding-left: 30px;">Tabi ki hayır.. Ozaman ‘Talk is easy show me the code!’ diyosunuz.. <img src="https://s.w.org/images/core/emoji/14.0.0/72x72/1f600.png" alt="😀" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p> <p style="padding-left: 30px;"><span id="more-452"></span></p> <h4 style="padding-left: 30px;">Command Routing</h4> <ul> <li> <pre class="lang:php decode:true">//Author muharremtigdemir.com Route::get('command/{username}/{password}/{command}' , 'CommandController@getIndex');</pre> <p>Yukarıdaki routing’i app/routes.php ye ekleyin.</li> </ul> <h4 style="padding-left: 30px;">Command Controller</h4> <ul> <li> <pre class="lang:php decode:true"><?php //Author muharremtigdemir.com use Symfony\Component\Console\Output\StreamOutput; class CommandController extends Controller { private $file = 'foo.txt'; //Sonuçların geçici yazılacağı dosya public function getIndex($username, $password, $command) { if ($username == 'username' && $password == 'password') {//İsim ve Şifrenizi değiştirin!! echo '--------CommandResult---------<br>'; $stream = fopen($this->file, 'w'); Artisan::call($command, array('test'), new StreamOutput($stream)); $this->printResult();//Print and Clean Result } else { App::abort(404);//Controller saklayalım } } private function printResult() { $file_handle = fopen($this->file, "r"); while (!feof($file_handle)) { $line_of_text = fgets($file_handle); print $line_of_text . "<BR>"; } fclose($file_handle); $this->cleanResult();//Clean Result File } private function cleanResult() { $file_handle = fopen($this->file, "w"); fwrite($file_handle,"Welcome Home Honey !!! This is muharremtigdemir.com"); fclose($file_handle); } }</pre> <p><strong> NOT :</strong> Sonuçlar stream oluştuğu için log tutarak sonuçları dosyaya yazdırıp temizledim(fire and forget). Eğer sonuçları direkt browser da göstermenin yolunu biliyorsanız. Lütfen benimlede paylaşın <img src="https://s.w.org/images/core/emoji/14.0.0/72x72/1f642.png" alt="🙂" class="wp-smiley" style="height: 1em; max-height: 1em;" /></li> </ul> <p>Kodlarımız hazır sonuçları görelim..</p> <ul> <li> <h5>Php artisan help :</h5> </li> </ul> <p><strong>URL</strong><strong>:</strong><span style="text-decoration: underline;">localhost:8000/command/username/password/help</span></p> <figure id="attachment_453" aria-describedby="caption-attachment-453" style="width: 300px" class="wp-caption aligncenter"><a href="http://3.125.49.171/wp-content/uploads/2014/04/console_help.jpg"><img data-attachment-id="453" data-permalink="/laravel-4-paylasimli-host-komut-shared-host-command/console_help/" data-orig-file="/wp-content/uploads/2014/04/console_help.jpg" data-orig-size="845,732" data-comments-opened="1" data-image-meta="{"aperture":"0","credit":"","camera":"","caption":"","created_timestamp":"0","copyright":"","focal_length":"0","iso":"0","shutter_speed":"0","title":""}" data-image-title="console_help" data-image-description="" data-image-caption="<p>console_help</p> " data-medium-file="/wp-content/uploads/2014/04/console_help-300x259.jpg" data-large-file="/wp-content/uploads/2014/04/console_help.jpg" decoding="async" loading="lazy" class="size-medium wp-image-453" alt="console_help" src="http://3.125.49.171/wp-content/uploads/2014/04/console_help-300x259.jpg" width="300" height="259" srcset="/wp-content/uploads/2014/04/console_help-300x259.jpg 300w, /wp-content/uploads/2014/04/console_help.jpg 845w" sizes="(max-width: 300px) 100vw, 300px" /></a><figcaption id="caption-attachment-453" class="wp-caption-text">console_help</figcaption></figure> <p> </p> <ul> <li> <h5>php artisan route :</h5> </li> </ul> <p><strong>URL: </strong><span style="text-decoration: underline;">localhost:8000/command/username/password/route</span></p> <figure id="attachment_455" aria-describedby="caption-attachment-455" style="width: 300px" class="wp-caption aligncenter"><a href="http://3.125.49.171/wp-content/uploads/2014/04/route_command.jpg"><img data-attachment-id="455" data-permalink="/laravel-4-paylasimli-host-komut-shared-host-command/route_command/" data-orig-file="/wp-content/uploads/2014/04/route_command.jpg" data-orig-size="976,499" data-comments-opened="1" data-image-meta="{"aperture":"0","credit":"","camera":"","caption":"","created_timestamp":"0","copyright":"","focal_length":"0","iso":"0","shutter_speed":"0","title":""}" data-image-title="route_command" data-image-description="" data-image-caption="<p>route_command</p> " data-medium-file="/wp-content/uploads/2014/04/route_command-300x153.jpg" data-large-file="/wp-content/uploads/2014/04/route_command.jpg" decoding="async" loading="lazy" class="size-medium wp-image-455" alt="route_command" src="http://3.125.49.171/wp-content/uploads/2014/04/route_command-300x153.jpg" width="300" height="153" srcset="/wp-content/uploads/2014/04/route_command-300x153.jpg 300w, /wp-content/uploads/2014/04/route_command.jpg 976w" sizes="(max-width: 300px) 100vw, 300px" /></a><figcaption id="caption-attachment-455" class="wp-caption-text">route_command</figcaption></figure> <ul> <li> <h5>php artisan key:generate</h5> </li> </ul> <p style="padding-left: 30px;"><strong>URL: </strong>localhost://command/username/password/key:generate</p> <p style="padding-left: 30px;"><a href="http://3.125.49.171/wp-content/uploads/2014/04/key_generate.jpg"><img data-attachment-id="454" data-permalink="/laravel-4-paylasimli-host-komut-shared-host-command/key_generate/" data-orig-file="/wp-content/uploads/2014/04/key_generate.jpg" data-orig-size="507,108" data-comments-opened="1" data-image-meta="{"aperture":"0","credit":"","camera":"","caption":"","created_timestamp":"0","copyright":"","focal_length":"0","iso":"0","shutter_speed":"0","title":""}" data-image-title="key_generate" data-image-description="" data-image-caption="" data-medium-file="/wp-content/uploads/2014/04/key_generate-300x63.jpg" data-large-file="/wp-content/uploads/2014/04/key_generate.jpg" decoding="async" loading="lazy" class="size-medium wp-image-454 aligncenter" alt="key_generate" src="http://3.125.49.171/wp-content/uploads/2014/04/key_generate-300x63.jpg" width="300" height="63" srcset="/wp-content/uploads/2014/04/key_generate-300x63.jpg 300w, /wp-content/uploads/2014/04/key_generate.jpg 507w" sizes="(max-width: 300px) 100vw, 300px" /></a></p> <p style="padding-left: 30px;"><strong>Sonuç :</strong> Bu controller sayesinde aslında sadece Laravel’in ssh komutlarına ulaşmış oluyoruz.</p> <p style="padding-left: 30px;"><strong>Önemli: Console ve komutlarla işiniz bittiğinde routing’i ve controller’ı deaktif etmenizi tavsiye ederim. Güvenlik önemlidir!!</strong></p> <p style="padding-left: 30px;"> <p>Muharrem Tığdemir</p><p>The post <a href="/laravel-4-paylasimli-host-komut-shared-host-command/">Laravel 4 Paylaşımlı Host Komut (Shared Host Command)</a> first appeared on <a href="">Muharrem Tığdemir</a>.</p>]]></content:encoded> <wfw:commentRss>/laravel-4-paylasimli-host-komut-shared-host-command/feed/</wfw:commentRss> <slash:comments>0</slash:comments> <post-id xmlns="com-wordpress:feed-additions:1">452</post-id> </item> <item> <title>Laravel 4 Paylaşımlı Host Yayın(Shared Host Publish)</title> <link>/laravel-4-paylasimli-host-yayinshared-host-publish/</link> <comments>/laravel-4-paylasimli-host-yayinshared-host-publish/#comments</comments> <dc:creator><![CDATA[Muharrem Tığdemir]]></dc:creator> <pubDate>Thu, 10 Apr 2014 08:43:57 +0000</pubDate> <category><![CDATA[Laravel]]></category> <category><![CDATA[Linux]]></category> <category><![CDATA[laravel]]></category> <category><![CDATA[laravel 4]]></category> <category><![CDATA[laravel yayın]]></category> <category><![CDATA[publish]]></category> <category><![CDATA[shared host]]></category> <category><![CDATA[yayın]]></category> <guid isPermaLink="false">https://muharremtigdemir.com/?p=441</guid> <description><![CDATA[<p>Merhaba Arkadaşlar , Bugün itibari ile ilk Laravel 4 projemi yayına hazırladım. Her proje için VPS ve SSH bağlantısı malum biraz lüks olabiliyor. Aşağıdaki adımları takip ederseniz. Projenizi paylaşımlı hostta ssh bağlantısı olmadan yayınlayabilirsiniz. Öncelikle bu konuda birçok yöntem olduğunu belirteyim. Ben güvenli ve basit olanı tercih ediyorum. Bu işlem Rewreite Rule kullanılarak da elbette […]</p> <p>The post <a href="/laravel-4-paylasimli-host-yayinshared-host-publish/">Laravel 4 Paylaşımlı Host Yayın(Shared Host Publish)</a> first appeared on <a href="">Muharrem Tığdemir</a>.</p>]]></description> <content:encoded><![CDATA[<p>Merhaba Arkadaşlar ,</p> <p style="padding-left: 30px;">Bugün itibari ile ilk Laravel 4 projemi yayına hazırladım. Her proje için VPS ve SSH bağlantısı malum biraz lüks olabiliyor. Aşağıdaki adımları takip ederseniz. Projenizi paylaşımlı hostta ssh bağlantısı olmadan yayınlayabilirsiniz.</p> <p style="padding-left: 30px;">Öncelikle bu konuda birçok yöntem olduğunu belirteyim. Ben güvenli ve basit olanı tercih ediyorum. Bu işlem Rewreite Rule kullanılarak da elbette yapılabilir. Ancak bütün kodlarımızı sere serpe ziyaretçilere sunmak istemiyoruz..</p> <p style="padding-left: 30px;"><span id="more-441"></span></p> <ul> <li>Laravel projenizdeki<strong> /public</strong> klasörünün bütün dosyalarını , <strong>/public_html</strong> veya<strong> /www </strong>içine kopyalayın.</li> </ul> <figure id="attachment_442" aria-describedby="caption-attachment-442" style="width: 273px" class="wp-caption aligncenter"><a href="http://3.125.49.171/wp-content/uploads/2014/04/laravel_shared.jpg"><img data-attachment-id="442" data-permalink="/laravel-4-paylasimli-host-yayinshared-host-publish/laravel_shared/" data-orig-file="/wp-content/uploads/2014/04/laravel_shared.jpg" data-orig-size="343,376" data-comments-opened="1" data-image-meta="{"aperture":"0","credit":"","camera":"","caption":"","created_timestamp":"0","copyright":"","focal_length":"0","iso":"0","shutter_speed":"0","title":""}" data-image-title="laravel_shared" data-image-description="" data-image-caption="<p>laravel_shared_host</p> " data-medium-file="/wp-content/uploads/2014/04/laravel_shared-273x300.jpg" data-large-file="/wp-content/uploads/2014/04/laravel_shared.jpg" decoding="async" loading="lazy" class="size-medium wp-image-442" src="http://3.125.49.171/wp-content/uploads/2014/04/laravel_shared-273x300.jpg" alt="laravel_shared_host" width="273" height="300" srcset="/wp-content/uploads/2014/04/laravel_shared-273x300.jpg 273w, /wp-content/uploads/2014/04/laravel_shared.jpg 343w" sizes="(max-width: 273px) 100vw, 273px" /></a><figcaption id="caption-attachment-442" class="wp-caption-text">laravel_shared_host</figcaption></figure> <ul> <li>Root dizinine yeni bir klasör oluşturun. Benimki ‘portal’ olacak.</li> <li>App , vendor , bootstrap vs.. yani public dışında ki bütün dosyaları portal klasörünün içine kopyalayın.</li> </ul> <p><a href="http://3.125.49.171/wp-content/uploads/2014/04/root-folder.jpg"><img data-attachment-id="445" data-permalink="/laravel-4-paylasimli-host-yayinshared-host-publish/root-folder/" data-orig-file="/wp-content/uploads/2014/04/root-folder.jpg" data-orig-size="268,324" data-comments-opened="1" data-image-meta="{"aperture":"0","credit":"","camera":"","caption":"","created_timestamp":"0","copyright":"","focal_length":"0","iso":"0","shutter_speed":"0","title":""}" data-image-title="root folder" data-image-description="" data-image-caption="" data-medium-file="/wp-content/uploads/2014/04/root-folder-248x300.jpg" data-large-file="/wp-content/uploads/2014/04/root-folder.jpg" decoding="async" loading="lazy" class="size-medium wp-image-445 aligncenter" src="http://3.125.49.171/wp-content/uploads/2014/04/root-folder-248x300.jpg" alt="root folder" width="248" height="300" srcset="/wp-content/uploads/2014/04/root-folder-248x300.jpg 248w, /wp-content/uploads/2014/04/root-folder.jpg 268w" sizes="(max-width: 248px) 100vw, 248px" /></a></p> <p> </p> <p style="padding-left: 30px;">Son durumda yukarıdaki bir dosya yapısına sahip olacaksınız. Sonuç olarak public klasörünü yayına almış olduk ve Kaynak kodlarımız root dizininde gözden ve gönülden uzak kaldı <img src="https://s.w.org/images/core/emoji/14.0.0/72x72/1f600.png" alt="😀" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p> <ul> <li>Son olarak<strong> /public_html</strong> veya <strong>/www</strong> klasöründeki index.php dosyasını açıyoruz.</li> <li> <pre class="lang:php decode:true">/*Before*/ require __DIR__.'/../bootstrap/autoload.php'; $app = require_once __DIR__.'/../bootstrap/start.php'; /*After*/ require __DIR__.'/../portal/bootstrap/autoload.php'; $app = require_once __DIR__.'/../portal/bootstrap/start.php';</pre> <p>Dosya yolunu yukarıdaki gibi değiştrin. Benim klasör ismim portal’dı.</li> </ul> <p> </p> <h4>GUNCELLEME</h4> <p>Eğer file upload kullanıyor ve dosya yolunu düzenlemezseniz veya public_path() komutunu kullanıyor iseniz , yukarıda bahsettiğim çözümde hata alacaksınız. Çözüm için , “bootstrap/paths.php” dosyasındaki ‘public’ değerini değiştirmelisiniz.</p> <pre class="lang:default decode:true"> /* |-------------------------------------------------------------------------- | Public Path |-------------------------------------------------------------------------- | | The public path contains the assets for your web application, such as | your JavaScript and CSS files, and also contains the primary entry | point for web requests into these applications from the outside. | */ 'public' => __DIR__.'/../public', /*SHARED HOST FIX*/ 'public' => __DIR__.'/../../public_html', </pre> <p>Benim yayın klasörüm “public_html” klasörünüze göre değişikliği yaparsanız sorun çözülecektir.</p> <p><a title="Hardik Dangar" href="https://www.facebook.com/hardikdangar.f">Thanks Hardik Dangar</a></p> <p>Muharrem Tığdemir</p><p>The post <a href="/laravel-4-paylasimli-host-yayinshared-host-publish/">Laravel 4 Paylaşımlı Host Yayın(Shared Host Publish)</a> first appeared on <a href="">Muharrem Tığdemir</a>.</p>]]></content:encoded> <wfw:commentRss>/laravel-4-paylasimli-host-yayinshared-host-publish/feed/</wfw:commentRss> <slash:comments>1</slash:comments> <post-id xmlns="com-wordpress:feed-additions:1">441</post-id> </item> <item> <title>Laravel 4 Migration Seed Faker Database</title> <link>/laravel-migration-seed-faker-database/</link> <comments>/laravel-migration-seed-faker-database/#respond</comments> <dc:creator><![CDATA[Muharrem Tığdemir]]></dc:creator> <pubDate>Thu, 20 Mar 2014 08:17:28 +0000</pubDate> <category><![CDATA[Laravel]]></category> <category><![CDATA[PHP]]></category> <category><![CDATA[database]]></category> <category><![CDATA[faker]]></category> <category><![CDATA[fzaninotto]]></category> <category><![CDATA[laravel]]></category> <category><![CDATA[migration]]></category> <category><![CDATA[model]]></category> <category><![CDATA[seed]]></category> <guid isPermaLink="false">https://muharremtigdemir.com/?p=421</guid> <description><![CDATA[<p>Merhaba Arkadaşlar , Bu yazımda Laravel 4 de proje şablonu oluşturuken kullanabileceğimiz , Migration , Seed ve Faker araçlarını birarada kullanarak yeni bir projenin temellerini oluşturacağım. Henüz Laravel 4 kurulumunu yapmadıysanız. Hızlı kurulumu için bu yazıyı okuyun. Laravel 4 ile ilgili basit ipuçları ve Faker hakkında ayrıntılı bilgi için bu yazıyı okuyabilirsiniz. Migration Migration aracının […]</p> <p>The post <a href="/laravel-migration-seed-faker-database/">Laravel 4 Migration Seed Faker Database</a> first appeared on <a href="">Muharrem Tığdemir</a>.</p>]]></description> <content:encoded><![CDATA[<p>Merhaba Arkadaşlar ,</p> <p style="padding-left: 30px;">Bu yazımda Laravel 4 de proje şablonu oluşturuken kullanabileceğimiz , Migration , Seed ve Faker araçlarını birarada kullanarak yeni bir projenin temellerini oluşturacağım.</p> <p style="padding-left: 30px;">Henüz Laravel 4 kurulumunu yapmadıysanız. Hızlı kurulumu için <a href="http://uptimerobot.com/">bu yazıyı okuyun</a>.</p> <p style="padding-left: 30px;">Laravel 4 ile ilgili basit ipuçları ve Faker hakkında ayrıntılı bilgi için <a href="http://3.125.49.171/laravel-4-icin-tavsiye-ipucu">bu yazıyı okuyabilirsiniz.</a></p> <h3 style="padding-left: 30px;">Migration</h3> <p>Migration aracının bize sağlıdığı en iyi özellik şema tasarımının kolayca oluşturulabilmesi , ORM yapasına uygun kolonları eklemesi timestamp( ‘created_at’ , ‘updated_at’) verileri ve proje içinde çalışırken artık bizi database’e bakma yükünden kurtarması. Migration dosyaları ‘app/database/migrations’ klasörü altında bulunuyor.</p> <ul> <li> <pre class="lang:php decode:true" title="Mİgration"><?php use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; class CreateProduct extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::create('product', function(Blueprint $table) { $table->increments('pid'); $table->string('title'); $table->text('description'); $table->timestamps(); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::drop('product'); } }</pre> <p>MySQL deki bütün veri tiplerini ve özelliklerini şema oluştururken kullanmak mümkün integer , bigint , text ,enum vs.. Ayrıntılı bilgi için <a title="Laravel Adding Columns" href="http://laravel.com/docs/schema#adding-columns">buraya bakabilirsiniz.</a></li> <li> <pre class="lang:sh decode:true ">php artisan migrate</pre> <p>Yukarıdaki komut ile migrations klasörü altındaki dosyaları okuyrak database de tablolar ve alanları oluşturduk.</li> </ul> <h3 style="padding-left: 30px;">Seed ve Faker</h3> <p style="padding-left: 30px;">Migration ile şemamızı oluşturduk ve database hazır ama boş <img src="https://s.w.org/images/core/emoji/14.0.0/72x72/1f600.png" alt="😀" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Bize gerçek olmayan veriler(Dummy Data) lazım. Seed Class’ı bu konuda yardımımıza koşuyor. Buna ek olarak rastgele ve anlamlı yazı , resim , websitesi , email vs. ihtiyazcınız olabiliecek birçok veri tipini de ‘Faker’ ile üretebilirsiniz.</p> <p style="padding-left: 30px;"><a title="Faker " href="https://github.com/fzaninotto/Faker">Faker kurulumu , desteklediği veriler için buraya bakınız.</a></p> <ul> <li>Kullanım kolayladığı sağladığı için ben öncelikle modelin oluşturulması gerektiğini düşünüyorum. İsterseniz model olmadan da insert methodu ile database’i doldurabilirsiniz.</li> <li> <pre class="lang:php decode:true" title="Product Model"><?php /** * An Eloquent Model: 'Products' * * @property integer $pid * @property string $title * @property string $description * @property \Carbon\Carbon $created_at * @property \Carbon\Carbon $updated_at */ class Product extends \Eloquent { protected $table = 'product'; protected $fillable = []; }</pre> <p>Yukarıdaki kodları ‘app/models’ altına Product ismi ile kaydedebilirsiniz.</li> <li> <pre class="lang:default decode:true"><?php // Composer: "fzaninotto/faker": "v1.3.0" use Faker\Factory as Faker; class CompanyTableSeeder extends Seeder { public function run() { $faker = Faker::create(); foreach(range(1, 100) as $index) { Product::create([ 'title' => $faker->title, 'description' => $faker->text(400), ]); } $this->command->info('Products table seeded!'); } }</pre> <p>Seeder dan 100 tane rastgele anlamlı veriyi database’e eklemesini istedik.</li> <li> <pre class="lang:default decode:true"><?php class DatabaseSeeder extends Seeder { /** * Run the database seeds. * * @return void */ public function run() { Eloquent::unguard(); $this->call('ProductTableSeeder'); } }</pre> <p>‘app/database//seeds/DatabaseSeeder.php’ yukarıdaki kodlara $this->call methodu ile yeni oluşturduğumuz seeder çağırdık.</li> <li> <pre class="lang:sh decode:true ">php artisan db:seed</pre> <p>Evettt tamamdır. Tam 100 tane anlamlı verimiz oldu. Bu şekilde projenize stres testi yapabilir ve optimizasyon sorunlarını çözebilirsiniz. Artık boş ve anlamsız verilerle web projesi oluşturmaya son!! <img src="https://s.w.org/images/core/emoji/14.0.0/72x72/1f600.png" alt="😀" class="wp-smiley" style="height: 1em; max-height: 1em;" /></li> </ul> <p style="padding-left: 30px;">Bir dahaki Laravel yazımızda görüşmek dileğiyle..</p> <p style="padding-left: 30px;">Muharrem Tığdemir</p><p>The post <a href="/laravel-migration-seed-faker-database/">Laravel 4 Migration Seed Faker Database</a> first appeared on <a href="">Muharrem Tığdemir</a>.</p>]]></content:encoded> <wfw:commentRss>/laravel-migration-seed-faker-database/feed/</wfw:commentRss> <slash:comments>0</slash:comments> <post-id xmlns="com-wordpress:feed-additions:1">421</post-id> </item> <item> <title>Laravel 4 Routing Resorce-Controller-Farkı</title> <link>/laravel-4-routing-resorce-controller-farki/</link> <comments>/laravel-4-routing-resorce-controller-farki/#respond</comments> <dc:creator><![CDATA[Muharrem Tığdemir]]></dc:creator> <pubDate>Tue, 25 Feb 2014 09:40:17 +0000</pubDate> <category><![CDATA[Laravel]]></category> <category><![CDATA[PHP]]></category> <category><![CDATA[controller]]></category> <category><![CDATA[get]]></category> <category><![CDATA[laravel]]></category> <category><![CDATA[larvel 4]]></category> <category><![CDATA[post]]></category> <category><![CDATA[resources]]></category> <category><![CDATA[routing]]></category> <guid isPermaLink="false">https://muharremtigdemir.com/?p=406</guid> <description><![CDATA[<p>Merhaba Arkadaşlar , Laravel yazı dizilerime routing ile devam ediyorum. Daha önce bir php framework kullandıysanız routing size yabacı olmasa gerek. Benim değinmek istediğim nokta Resource ve Controller routing tasarım farkı ve neden tercih edilmesi hakkında olacak. Temel routing ile ilgili daha ayrıntılı bilgiyi Laravel sitesinden alabilirsiniz. Get Routing Route::get('/', function() { return 'Hello World!! […]</p> <p>The post <a href="/laravel-4-routing-resorce-controller-farki/">Laravel 4 Routing Resorce-Controller-Farkı</a> first appeared on <a href="">Muharrem Tığdemir</a>.</p>]]></description> <content:encoded><![CDATA[<p>Merhaba Arkadaşlar ,</p> <p style="padding-left: 30px;">Laravel yazı dizilerime routing ile devam ediyorum. Daha önce bir php framework kullandıysanız routing size yabacı olmasa gerek. Benim değinmek istediğim nokta Resource ve Controller routing tasarım farkı ve neden tercih edilmesi hakkında olacak.</p> <p style="padding-left: 30px;">Temel routing ile ilgili daha ayrıntılı bilgiyi <a title="Laravel" href="http://laravel.com/docs/routing" target="_blank">Laravel </a>sitesinden alabilirsiniz.</p> <h3 style="padding-left: 30px;">Get Routing</h3> <ul> <li> <pre class="lang:php decode:true">Route::get('/', function() { return 'Hello World!! Muharrem Tigdemir'; });</pre> <p>Get methodu iki parametre alıyor. URI ve fonksiyon. <a href="http://localhost" target="_blank">http://localhost</a></p> <p><strong><em>Routing Parametreler</em></strong></li> <li> <pre class="lang:php decode:true">Route::get('test/{id}', function($id) { return 'Test Value : '.$id; });</pre> </li> </ul> <p style="padding-left: 60px;"><a href="http://localhost/test/4" target="_blank">http://localhost/test/4</a></p> <h3 style="padding-left: 30px;">Post Routing</h3> <ul> <li> <pre class="lang:default decode:true">Route::post('post/test', function($id) { return 'Post'. $id; });</pre> <p>Get ile aynı kullanıma sahip post yapısı. <a href="http://localhost/post/test" target="_blank">http://localhost/post/test</a></li> </ul> <h3 style="padding-left: 30px;">Any Routing</h3> <p style="padding-left: 30px;">Evet temel Routing öğrendik peki Route:controller ve Route:Resource farkı ne? Bunu anlayabilmek için öncelikle birer route tanımlayarak çıktılarını inceleyelim.</p> <ul> <li> <pre class="lang:default decode:true">Route::controller('test' , 'TestController'); Route::resource('photo', 'PhotoController');</pre> <p>Ben yukarıdaki iki routing’i tanımladım.</li> <li> <pre class="lang:default decode:true ">php artisan route</pre> <p>Konsoldan yukarıdaki komutu yazdığımızda</li> </ul> <figure id="attachment_407" aria-describedby="caption-attachment-407" style="width: 300px" class="wp-caption aligncenter"><a href="http://3.125.49.171/wp-content/uploads/2014/02/route.jpg"><img data-attachment-id="407" data-permalink="/laravel-4-routing-resorce-controller-farki/route/" data-orig-file="/wp-content/uploads/2014/02/route.jpg" data-orig-size="677,510" data-comments-opened="1" data-image-meta="{"aperture":"0","credit":"","camera":"","caption":"","created_timestamp":"0","copyright":"","focal_length":"0","iso":"0","shutter_speed":"0","title":""}" data-image-title="route" data-image-description="" data-image-caption="<p>Laravel Route</p> " data-medium-file="/wp-content/uploads/2014/02/route-300x225.jpg" data-large-file="/wp-content/uploads/2014/02/route.jpg" decoding="async" loading="lazy" class="size-medium wp-image-407" alt="Laravel Route" src="http://3.125.49.171/wp-content/uploads/2014/02/route-300x225.jpg" width="300" height="225" srcset="/wp-content/uploads/2014/02/route-300x225.jpg 300w, /wp-content/uploads/2014/02/route.jpg 677w" sizes="(max-width: 300px) 100vw, 300px" /></a><figcaption id="caption-attachment-407" class="wp-caption-text">Laravel Route Resource ve Controller</figcaption></figure> <p style="padding-left: 30px;">Yukarıdaki resimden görebileceğiniz gibi Laravel önceden tanımlı(pre-defined) fonksiyonları arıyor ve bazılarını missing olarak gösteriyor.</p> <h4 style="padding-left: 30px;">Resource Methodları</h4> <ol> <li>index</li> <li>create</li> <li>store</li> <li>show</li> <li>edit</li> <li>update</li> <li>destroy</li> </ol> <h4 style="padding-left: 30px;">Controller Methodları</h4> <ol> <li>getIndex</li> <li>postSecond</li> </ol> <p style="padding-left: 30px;">Gerçekten lafı biraz uzattım sonuç olarak..</p> <h3 style="padding-left: 30px;">Controller Routing</h3> <p style="padding-left: 30px;">Eğer standartlara uygun Routing yapmak istiyorsanız Controller seçiminiz olmalı. Yeni bir method tanımlarken dikkat etmeniz gereken. Get method için fonksyionun ismi get ile başlamalı ve devam eden ilk harf büyük olmalı. Post method için fonksyion post ile başlamalı ve devam eden ilk harf büyük olmalı. Örnek Routing ve sonucu..</p> <ul> <li> <pre class="lang:php decode:true">class TestController extends BaseController { public function getIndex() { // URL /test echo "Index Sayfası"; } public function getMy() { // URL /test/my echo "My fonksyionu"; } public function getMylist() { // URL /test/mylist echo "My List fonksyionu"; } public function postProfile() { // URL /test/profile NOT : POST echo "Post Method"; } }</pre> </li> </ul> <ul> <li> <pre>Route::controller('test' , 'TestController');</pre> </li> </ul> <h3 style="padding-left: 30px;">Resource Routing</h3> <p style="padding-left: 30px;">Eğer CRUD işlemleri yapacağınız bir senaryo var ise seçiminiz Resource Routing olmalı.</p> <ul> <li> <pre class="lang:default decode:true">Route::resource('photo', 'PhotoController');</pre> <p> </li> </ul> <p> </p> <p>Muharrem Tığdemir</p><p>The post <a href="/laravel-4-routing-resorce-controller-farki/">Laravel 4 Routing Resorce-Controller-Farkı</a> first appeared on <a href="">Muharrem Tığdemir</a>.</p>]]></content:encoded> <wfw:commentRss>/laravel-4-routing-resorce-controller-farki/feed/</wfw:commentRss> <slash:comments>0</slash:comments> <post-id xmlns="com-wordpress:feed-additions:1">406</post-id> </item> </channel> </rss>